简体   繁体   English

从本地git存储库推送到两个不同的AWS CodeCommit

[英]Pushing from local git repository to two different aws codecommit

i have one local git repository, and i created one cron job to push from local git repository to Codecommit in every 10 mins, all developers are pushing there code to local git repository. 我有一个本地git存储库,我创建了一个cron作业,每隔10分钟从本地git存储库推送到Codecommit,所有开发人员都将代码推送到本地git存储库。 but i have two aws account, i want same cron job will push code to second aws codecommit account also. 但是我有两个aws帐户,我希望同一个cron作业也可以将代码推送到第二个aws codecommit帐户。

one config file we need to create in .ssh directory which we can create using aws-iam, but can i add to iam-access key for codecommit in one config file? 我们需要在.ssh目录中创建一个配置文件,我们可以使用aws-iam创建该配置文件,但是我可以在一个配置文件中添加iam-access密钥以进行代码提交吗? if you have any batter solution please suggest me. 如果您有任何解决方案,请建议我。

In recent git versions, it is possible to push simultaneously to more than one remotes. 在最新的git版本中,可以同时推送到多个遥控器。

To do this, I would recommend adding a new remote called all which, when you are using it, makes it clear that you are pushing to multiple remotes. 为此,我建议添加一个名为all的新遥控器,当您使用它时,它可以使您清楚地知道要推送到多个遥控器。

git remote add all git://HostA/repo1.git

Now add distinct pushurls for as many remotes as you wish like so: 现在,为任意多个遥控器添加不同的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

Finally, to push to all of them, use: 最后,要使用所有这些,请使用:

git push all master

(where master is the local branch you want to push from) (其中master是您要从中推送的本地分支)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM