'"Unable to negotiate" with AWS CodeCommit: "no matching host key type found"

I'm trying to connect to AWS CodeCommit with SSH. I've followed every step in this guide:

https://docs.aws.amazon.com/codecommit/latest/userguide/setting-up-ssh-windows.html#setting-up-ssh-windows-install-git

but when I get to where I need to run the following command

ssh [email protected]

I get this error

Unable to negotiate with 52.95.17.51 port 22: no matching host key type found. Their offer: ssh-rsa



Solution 1:[1]

Nvm i found a solution i had to add this to my .ssh/config file

HostKeyAlgorithms +ssh-rsa
PubkeyAcceptedKeyTypes +ssh-rsa

if you getting this error after you added those two lines

Bad configuration option: \240\240pubkeyacceptedkeytypes

is because the spaces in the config file arent spaces their 240 characters

this helped me

Bad configuration option: \240\240user when setting up Amazon CodeCommit

what i did was copy the spaces that were on my other lines and used them in the new lines i added

Solution 2:[2]

For me, the problem was that windows was referring to the wrong root hard drive disk. (because pc managed by system administrators)

The solution was to create a new environment variable called HOME. With the directory of your .ssh folder.

  • press windows key
  • write edit environment

enter image description here

  • Click on the first new button

enter image description here

  • variable name = HOME
  • variable value = directory of your .ssh folder

enter image description here

  • press ok

  • press the other ok to save the changes.

  • Apply @Austin Grant answer afterwards if it doesn't work.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 pupeno
Solution 2 Mo D Genesis