Git:在一个命令中推动两个回购 [英] Git: Pushing to two repos in one command
本文介绍了Git:在一个命令中推动两个回购的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想在同一行中执行 git push origin
和 git push my_other_remote
。可能吗?
I want to do git push origin
and git push my_other_remote
in the same line. Possible?
推荐答案
通过为您的 origin 添加额外的推送网址, code>远程。例如,如果您现有的遥控器的URL如下所示:
You can get the same effect by adding an extra push URL for your origin
remote. For example, if the URLs of your existing remotes are as follows:
$ git remote -v
origin me@original:something.git (fetch)
origin me@original:something.git (push)
my_other_remote git://somewhere/something.git (fetch)
my_other_remote git://somewhere/something.git (push)
您可以这样做:
You could do:
git remote set-url --add --push origin git://somewhere/something.git
然后, git push origin
将会推送到这两个存储库。但是,为避免混淆,您可能需要为此设置一个名为的新远程
。例如:
Then, git push origin
will push to both repositories. You might want to set up a new remote called both
for this, however, to avoid confusion. For example:
git remote add both me@original:something.git
git remote set-url --add --push both me@original:something.git
git remote set-url --add --push both git://somewhere/something.git
...然后:
... then:
git push both
...会尝试推送到这两个存储库。
... will try to push to both repositories.
这篇关于Git:在一个命令中推动两个回购的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文