GitRemote
OriginalMarch 1, 2019Less than 1 minute
Conclusion
Associate a remote repository
git remote add origin <url>
# Where origin is the default remote repository name, you can also modify it yourself
# The url can be the ssh protocol or the http protocol. It is recommended to use ssh, which is more secure.
Delete a remote repository
git remote rm origin
View a remote repository
git remote -v
Push commit to remote repository
git push origin master
# Generally used for non-first push
git push -u origin master
# -u parameter is to associate the local master branch with the master branch of the remote repository, which is generally used to push the code to the remote repository for the first time.
Caption
The current situation is that your local repository already exists, but you must have a remote repository so that your code can be developed collaboratively by others, and can also be used as a backup of a local repository.