My local laptop is a Mac.
The ssh key is configured properly. This is the content of ~/.ssh/config
Host barthea
Hostname git-codecommit.us-east
My case in OSX.
The first step:
git config --global credential.helper '!aws codecommit credential-helper $@'
git config --global credentials.helper UseHttpPath=true
However, verifying git config --list --show-origin
file:/usr/local/etc/gitconfig credential.https://git-codecommit.eu-west-1.amazonaws.com.helper=!aws codecommit credential-helper $@
file:/usr/local/etc/gitconfig credential.helper=osxkeychain
file:/Users/mine/.gitconfig user.name=my-user
file:/Users/mine/.gitconfig user.email=my@gmail.com
file:/Users/mine/.gitconfig filter.lfs.clean=git-lfs clean -- %f
file:/Users/mine/.gitconfig filter.lfs.smudge=git-lfs smudge -- %f
file:/Users/mine/.gitconfig filter.lfs.process=git-lfs filter-process
file:/Users/mine/.gitconfig filter.lfs.required=true
file:/Users/mine/.gitconfig credential.helper=!aws codecommit credential-helper $@
file:/Users/mine/.gitconfig credential.usehttppath=true
The first line was not present before, and git was using osxkeychain
with precedence. Hence, I had to do git config --system ...
cat /usr/local/etc/gitconfig
[credential "https://git-codecommit.eu-west-1.amazonaws.com"]
helper = !aws codecommit credential-helper $@
UseHttpPath = true
[credential]
helper = osxkeychain
So the URL was specified in order to fallback in case another credentials are stored.
Update https://docs.aws.amazon.com/codecommit/latest/userguide/troubleshooting-ch.html
For some reason, UseHttpPath = true seems not to be added sometimes. So it can (should) be added under [credential]