AWS Codecommit – fatal: unable to access : The requested URL returned error: 403

Issue

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 [email protected]
    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 [email protected]
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.

Solution

Just delete credentials as below and next time pop-up window prompt for credentials
Steps to delete your Credential Manager

Control Panel
Select "Credential Manager"
Under Generic Credential, delete the appropriate Git Credential.

Answered By – user2012975

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply

(*) Required, Your email will not be published