gitamazon-web-servicesubuntuaws-cliaws-codecommit

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


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:

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.