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

Use the region set for the default profile in .aws/config #29

Open felipe1982 opened 3 years ago

felipe1982 commented 3 years ago

I have the region set for the default profile in ~/.aws/config, however, when I use GRC, it isn't respected. I am therefore required to set it for every profile, which is a PITA because I only use one region.

Please support using the default region, where a region is not set for the target profile.

oleksii-donoha commented 3 years ago

I also find this annoying but having dug a bit through the code I think this might be intentional.

  1. You can already specify URL with region in it: git clone codecommit::us-east-1://demo-profile@MyRepositoryName
  2. In the code itself botocore session seems to get region specifically from scoped credentials, i.e. the exact specific profile section in credentials file. If the script will implicitly decide what the region should be, it can introduce unwanted behavior, like when there are 2 repos with the same name in different regions and git-remote-codecommit falls back to wrong region and performs some destructive operation on wrong repo. I think the intent might have been for user to be as explicit as possible.
felipe1982 commented 3 years ago

I think you might have a point. Moreover, when you click the icon to copy link to clipboard from the console, it includes the region. It seems we must use the region explicitly.

Please close this.