Reputation: 179
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. but i have two aws account, i want same cron job will push code to second aws codecommit account also.
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? if you have any batter solution please suggest me.
Upvotes: 0
Views: 1485
Reputation: 18869
In recent git versions, it is possible to push simultaneously to more than one remotes.
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.
git remote add all git://HostA/repo1.git
Now add distinct pushurls for as many remotes as you wish like so:
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)
Upvotes: 3