![](/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.