We are using AWS codecommit with its required git credential helper setup for https auth. My ~/.gitconfig
has these lines in it:
[credential]
helper =
helper = !aws --profile $GIT_AWS_PROFILE codecommit credential-helper $@
Where GIT_AWS_PROFILE=myaccount
.
But sometimes I want to pull from an account named "myaccount" and push to a repo with the same url in "otheraccount". I can do this by setting GIT_AWS_PROFILE=otheraccount
before pushing. But it would be nice if these two AWS accounts could be set up as two separate git remotes with different credential managers. Is there a way to do this? Or maybe there's a way to get clone urls from codecommit that are account-specific? As things are, the urls between accounts are identical, which seems to make it impossible to distinguish them as separate git remotes.
NOTE: While a similar question was asked here, I am specifically looking for how to handle pushes and pulls across repos in different AWS accounts which have identical remote urls.