Sunday , April 27 2025 11:54 AM
Home / Tutorials / How to Add a Project to Github using command line?

How to Add a Project to Github using command line?

Putting your existing work on GitHub can let you share and collaborate in lots of great ways.

Create a new repository on GitHub. To avoid errors, do not initialize the new repository with README, license, or gitignore files. You can add these files after your project has been pushed to GitHub.

Open Terminal.

Change the current working directory to your local project.

Initialize the local directory as a Git repository.

git init
$git add .
# Adds the files in the local repository and stages them for commit. To unstage a file, use 'git reset HEAD YOUR-FILE'.
$git commit -m "First commit"
# Commits the tracked changes and prepares them to be pushed to a remote repository. To remove this commit and modify the file, use 'git reset --soft HEAD~1' and commit and add the file again.
$git commit -m "change this to you commit message "
# Commits the tracked changes and prepares them to be pushed to a remote repository. To remove this commit and modify the file, use 'git reset --soft HEAD~1' and commit and add the file again.
$git remote add origin remote repository URL
# Sets the new remote
git remote -v
# Verifies the new remote URL
$git push origin master
# Pushes the changes in your local repository up to the remote repository you specified as the origin

 

 

 

Tip: If you’re most comfortable with a point-and-click user interface, try adding your project with GitHub Desktop. For more information, see “Adding a repository from your local computer to GitHub Desktop” in the GitHub Desktop Help.

 

About GOPU

Technology Enthusiast with a keen eye on the Cyber-security and other tech related developments.

Check Also

Google Dorks 2015

GOOGLE Dorks Dorks are an input query into a search engine (Google in our case) …