aws / git-remote-codecommit

An implementation of Git Remote Helper that makes it easier to interact with AWS CodeCommit
Apache License 2.0
272 stars 39 forks source link

Allow specifying account id in repo url #40

Open hoegertn opened 1 year ago

hoegertn commented 1 year ago

I would love to be able to specify the AWS account id in the repo URL to prevent fetch/push from repositories that have the same name but are in different accounts.

robisonsantos commented 1 year ago

You can do it via profiles.

Set different profiles for your different accounts, eg:

[my-account-1]
aws_access_key=AAAAABBBB
aws_secret_access=BBBBBCCCCDDD

[my-account-2]
aws_access_key=EEEEEFFFFF
aws_secret_access=AAAAXXXXXDDDD

Then, you can specify your repo URL as

codecommit::<region>://<profile>@<repository>

Like:

codecommit::us-east-1://my-account-2@my-awesome-repo