You get Unable to negotiate with ip port 22: no matching host key type found error when you try to authenticate on Github with SSH using
ssh-rsa algorithm. ssh-rsa is insecure as it uses SHA-1 protocol. Even it is deprecated by openssh and they declared it in their press release.
Solution with Code Example
The best solution is to not use
ssh-rsa as it is insecure and cryptographically not safe. There are better alternatives available like rsa-sha2-256 which uses SHA-256 protocol and rsa-sha2-512 which uses SHA-512 protocol.
But if you need to use
ssh-rsa only (like Azure DevOps only support ssh-rsa) for connecting to the Github, GitLab, BitBucket etc. then you can add exception to the ssh config file –
.ssh/config file and add this –
Host ssh.dev.azure.com HostName ssh.dev.azure.com User git IdentityFile ~/.ssh/id_rsa IdentitiesOnly yes PubkeyAcceptedAlgorithms +ssh-rsa HostkeyAlgorithms +ssh-rsa
Another solution is to use HTTPS instead of ssh.