connect local repo with remote repo

2019-01-31 11:17发布

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?

2条回答
放荡不羁爱自由
2楼-- · 2019-01-31 11:38
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
查看更多
劫难
3楼-- · 2019-01-31 11:38

I know it has been quite sometime that you asked this but, if someone else needs, I did what was saying here " How to upload a project to Github " and after the top answer of this question right here. And after was the top answer was saying here "git error: failed to push some refs to" I don't know what exactly made everything work. But now is working.

查看更多
登录 后发表回答