I was able to pull and/or push updated from my AWS CodeCommit repository until I reinstalled aws-cli
.
I tried all the suggested solutions I could find but nothing seems to work.
I am working on Ubuntu 21.10 and installed:
$ aws --v
aws-cli/1.19.1 Python/3.9.7 Linux/5.13.0-41-generic botocore/1.20.0
git version 2.32.0
The error I am getting is:
fatal: unable to access 'https://git-codecommit.eu-west-2.amazonaws.com/v1/repos/myrepo/': The requested URL returned error: 403
It used to ask me for my username and password, but after my experiments to solve the issue it stopped asking for my credentials completely. Either way I confirmed that I was using the correct credentials. Also, I do have the necessary permissions at AWS. I was successfully pulling and pushing updates until a few hours ago.
The aws credential helper is set as recommended by most solutions online. More specifically my .gitconfig
file looks like this:
[user]
name = My_name
email = My_email
[credential]
helper = !aws codecommit credential-helper $@
UseHttpPath = true
Additionally, I set up correctly (with the correct region) the $ aws configure
configuration.
Listing $ git config --list --show-origin
I am getting:
file:/etc/gitconfig user.email=My_email
file:/home/f_user/.gitconfig user.name=My_name
file:/home/f_user/.gitconfig user.email=My_email
file:/home/f_user/.gitconfig credential.helper=!aws codecommit credential-helper $@
file:/home/f_user/.gitconfig credential.usehttppath=true
Honestly I have no idea what else to try, any help would be appreciated!
EDIT: The way I resolved the issue is:
- Uninstalled aws client from my system and re installed and configured it from scratch.
- I cloned my IAM account and gave it Full AWSCodeCommit access.
I am not sure what was the part that solved it, probably the first step.
CodePudding user response:
Double-check your AWS managed policies for for CodeCommit.
If your IAM User has switched to ForceMultiFactorAuthentication
as policy, you would need to use a token, not your password.
Locally, check what password is stored by your credential manager:
printf "protocol=https\nhost=git-codecommit.eu-west-2.amazonaws.com"|aws codecommit credential-helper get
CodePudding user response:
The way I resolved the issue after all is:
Uninstalled aws client from my system and re installed and configured it from scratch.
I cloned my IAM account and gave it Full AWSCodeCommit access.
I am not sure what was the part that solved it, probably the first step since after I reinstalled everything I was prompted again to use my credentials.