【发布时间】:2022-01-14 07:50:21
【问题描述】:
我有一个本地仓库,它有一些分支,例如branch1, branch2..
我想将分支推送到不同的远程仓库,如何?
【问题讨论】:
-
这是关于配置你的 git 遥控器。我会建议了解他们。从长远来看,它将对您有所帮助。 Stackoverflow 已经有很多帖子可以帮助你。 This can help。还有For more detailed explanation
我有一个本地仓库,它有一些分支,例如branch1, branch2..
我想将分支推送到不同的远程仓库,如何?
【问题讨论】:
简单
git push https://repo.one/there branch1
git push https://repo.two/elsewhere branch2
如果你想缩短你的命令,你可以预定义远程目的地:
git remote add one https://repo.one/there
git remote add two https://repo.two/elsewhere
那么命令可以缩短为
git push one branch1
git push two branch2
您还可以设置默认推送目的地:
git branch --set-upstream-to=one/branch1 branch1
git branch --set-upstream-to=two/branch2 branch2
【讨论】: