![](/img/trans.png)
[英]How to setup git config for pushing to two different remote repositories from the same local repository?
[英]Pushing from local git repository to two different aws codecommit
我有一个本地git存储库,我创建了一个cron作业,每隔10分钟从本地git存储库推送到Codecommit,所有开发人员都将代码推送到本地git存储库。 但是我有两个aws帐户,我希望同一个cron作业也可以将代码推送到第二个aws codecommit帐户。
我们需要在.ssh目录中创建一个配置文件,我们可以使用aws-iam创建该配置文件,但是我可以在一个配置文件中添加iam-access密钥以进行代码提交吗? 如果您有任何解决方案,请建议我。
在最新的git版本中,可以同时推送到多个遥控器。
为此,我建议添加一个名为all
的新遥控器,当您使用它时,它可以使您清楚地知道要推送到多个遥控器。
git remote add all git://HostA/repo1.git
现在,为任意多个遥控器添加不同的pushurl:
git remote set-url --add --push all git://HostA/repo1.git
git remote set-url --add --push all git://HostB/repo2.git
git remote set-url --add --push all git://HostC/repo3.git
最后,要使用所有这些,请使用:
git push all master
(其中master
是您要从中推送的本地分支)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.