Existing Project To GitHub Move

Push an existing project to GitHub using Command line

Sometimes we start working on a project and later we need it to be share in GitHub.



So its not a worry thing, just follow below steps to upload it in GitHub using simply with terminal

Steps 1 ) Open Dashboard -> Open Terminal

Steps 2)  Change the current working directory to your local project.

In terminal type

cd drag your project directory here ,it will automatically take its path

Step 3 ) Initialize the local directory as a Git repository by typing below command in your terminal

         git init

Step 4) To stages them for the first commit, add the files in your new local repository by typing below           command in your terminal

git add .

# Adds the files in the local repository and stages them for commit. To unstage a file, use ‘git reset HEAD YOUR-FILE’.

Step 5 ) For commit the files using terminal type below common

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.

Step 6 ) Copy the remote repository URL which is at the top of your GitHub repository’s Setup page . then type below command in your terminal

git remote add origin paste_your_repository_URL_here

#Sets the new remote

git remote -v

# verifies the new remote URL



Step 7 ) Finally you can push the changes from your local repository to GitHub by typing below command in your terminal

git push -u origin master

# Pushes the changes in your local repository up to the remote repository you specified as the origin




Add a Comment

Your email address will not be published. Required fields are marked *