0

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.

xdhmoore
  • 8,935
  • 11
  • 47
  • 90
  • 1
    Does this answer your question? [git multiple credential helper](https://stackoverflow.com/questions/53189190/git-multiple-credential-helper) – phd Jan 15 '20 at 20:35
  • I read that one first. It is very similar, but it doesn't talk about identical remote urls. Also, the answer doesn't address it. – xdhmoore Jan 15 '20 at 20:51
  • Updated to make that more clear. – xdhmoore Jan 15 '20 at 20:59

0 Answers0