connect local repo with remote repo

Om3ga picture Om3ga · Jun 25, 2012 · Viewed 102.8k times · Source

I have a local repo. I created the whole app but now I want to push it to remote repo. I already have remote repo as well. How can I connect these two repos without losing any work that I did?

Answer

vergenzt picture vergenzt · Jun 25, 2012
git remote add origin <remote_repo_url>
git push --all origin

If you want to set all of your branches to automatically use this remote repo when you use git pull, add --set-upstream to the push:

git push --all --set-upstream origin