Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Git clone works in AWS CodeCommit but pushing fails with 403

I can clone my CodeCommit repository successfully, but when I try to push to it, I get 403. Fetching and pulling works, however. It's as if I have read-only access.

I have setup my .gitconfig to use AWS CLI for credential manager:

[credential]
        helper = !aws --profile builder codecommit credential-helper $@
        UseHttpPath = true

The problem is that the error doesn't tell me why pushing is failing:

$ git push origin test-branch
fatal: unable to access 'https://git-codecommit.us-east-1.amazonaws.com/v1/repos/my-example-repo/': The requested URL returned error: 403

Most questions on the internet about his error are when cloning fails, but cloning works for me. I found this question where cloning succeeds and pushing fails, but his error is different - aws codecommit cannot push.

Edit:: After looking at my CodeCommit policy, it has Full: Read Limited: List, Write:

enter image description here

There is also a ResourceSpecifier = foo-*, but that holds for GitPull permission and pulling works, so I doubt it's the resource specifier.

like image 979
sashoalm Avatar asked Oct 11 '25 17:10

sashoalm


1 Answers

For MacOS: Delete the code-commit internet passwords in Keychain and try again. Also:

git config --global credential.helper '!aws codecommit credential-helper $@'
git config --global credential.UseHttpPath true