CodeCommit SSH Issues

Filed under aws on November 30, 2021

Just a short one, went to pull some changes from CodeCommit and got the follow error

Unable to negotiate with 103.8.174.37 port 22: no matching host key type found. Their offer: ssh-rsa
fatal: Could not read from remote repository.

Looks like OpenSSH has changed around some defaults and won’t automatically accept SSH offers, no big deal. Add the following to your CodeCommit section in ~/.ssh/config

Host git-codecommit.*.amazonaws.com
   User AAAAAAAAAAAAAAAAAAAA
   IdentityFile ~/.ssh/id_codecommit
   # Add these to let the SSH client accept RSA keys
   PubkeyAcceptedAlgorithms +ssh-rsa
   HostkeyAlgorithms +ssh-rsa

Maybe eventually AWS will accept ed25519 keys and give us a longer term fix, but for now this will have to do.


Stephen Gream

Written by Stephen Gream who lives and works in Melbourne, Australia. You should follow him on Minds