大家好,我想让git同时推送到两个服务器,需要配置几个ssh?
我的情况:
先配置了github的ssh,但是我还想同时部署到oschina上,是否也要配置一个ssh?可是这样不和github的ssh冲突了吗,同时push不到github上,只能push到oschina上。
还是像网上大多数说的下面这样?我配置好github的ssh后就不管了,直接像下面这样?
[remote "all"]
url = https://github.com/XXXXXX/XXXXX.git
url = https://git.oschina.net/XXXXX/XXXXX.git
小白先谢谢回答者了(三鞠躬)
某草草2017-05-02 09:51:20
If git supports pushing to multiple servers at the same time, you can use the following command
git remote set-url --add <name> <newurl>
If you already have the default remote host origin which is GitHub, you can use the following method to add the address of oschina to origin
git remote set-url --add origin <oschina url>
In this way git push origin
you can submit to GitHub and oschina at the same time.
git-remote
If you type on your mobile phone, the formatting is wrong and I will change it on my computer.
迷茫2017-05-02 09:51:20
If you want to push to two servers, you only need to set up two remotes, and then push your own branch.
git remote add github <github-repo>
git remote add oschina <oschina-repo>
git push github master
git push oschina master
Also, you can refer to the list I made about the remote warehouse git cheat sheet