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

How to remove the existing aws credentials and point codecommit to the new aws sso account #24

Open nishitjain13 opened 3 years ago

nishitjain13 commented 3 years ago

I have been working on a project where I have used codecommit as my repository. My Linux system is configured with the credentials of my personal aws account(for which I had the private and the security key). I now need to push the code into my company's aws account (in which I am a federated user with sso credentials).

I have removed my old remote (which was in my personal aws account), and am trying to use git-remote-codecommit to add the new repo (Textanalysis) with the following command:

git add remote cc codecommit::us-east-2://Textanalysis

However, my CLI seems to still be pointing to my personal aws, and not to the corporate one. And it is not able to find this repo.

How do we get the CLI to point to the new aws account?

DmitryNefedov commented 3 years ago

You should include your profile name from ~./aws/credentials to the remote URL. If you have [cool-company] as your cli profile for the company, then use codecommit::us-east-2://cool-company@Textanalysis as your remote url. Without specifying the profile - it tries to use your default, which, I assume, points to your personal account and doesn't have a repo called Textanalysis