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
One line exact answer is provided by "vergenzt" but if you want to go through the detail on how to commit your code and connect local and remote github repo and push code into remote repo using git cli, you can go through this article : https://medium.com/geekstrends/a-beginners-guide-to-starting-with-git-cli-1d5c44af0a4
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With