Sunday 29 May 2016

Pushing existing local project to Github

Background

We have seen before how to clone a remote repository to local, work on it, modify files, commit and push to remote repository. But most of the time what happens we have a project on local (a new one) and want to save it on github. In this post we will see how to do that.



Pushing existing local project to Github

You will need to initialize a new repository on Github first. Simple create an empty repository.




Now to add your local repo you can execute following commands -
  1. mkdir MyTestRepo
  2. cd MyTestRepo/
  3. touch test.txt
  4. git init
  5. git add .
  6. git commit -m "First commit"
  7. git remote add origin https://github.com/aniket91/MyTestRepo.git
  8. git push -f origin master

Output is as follows -


You can then see this commit on remote.

After creating a new repo on github you will see following options -



Related Links

No comments:

Post a Comment

t> UA-39527780-1 back to top