The error “Unable to negotiate with 40.74.28.9 port 22: no matching host key type found. Their offer: ssh-rsa” is an error that is invoked whenever you are using azure DevOps repositories. Given below is the snippet of the error which you can find here:
xyz@xyz> git pull
Unable to negotiate with 40.74.28.9 port 22: no matching host key type found. Their offer: ssh-rsa
fatal: Could not read from remote repository.
Please make sure you have the correct access rights and the repository exists.
I would like to share with you the steps I took to fix the “Unable to negotiate with 40.74.28.9 port 22: no matching host key type found. Their offer: ssh-rsa” in your file.
Why “Unable to negotiate with 40.74.28.9 port 22: no matching host key type found. Their offer: ssh-rsa” error is seen?
The error, “Unable to negotiate with 40.74.28.9 port 22: no matching host key type found. Their offer: ssh-rsa” is seen because Azure DevOps only has only the support of kind of RSA with SHA-1, and SHA-1 is considered very weak. This basically means that there is no secure ways to connect to it over SSH, and until Azure DevOps fix the error.
The detailed solution to fix the error “Error: error:0308010C:digital envelope routines::unsupported”, is given below:
How to fix the error, “Error: error:0308010C:digital envelope routines::unsupported”?
As an alternate, you can try to use HTTPS or a completely different hosting service. GitHub, GitLab, and Bitbucket all support secure methods of authentication.
To fix the error, “Error: error:0308010C:digital envelope routines::unsupported”, follow one of the methods given below:
Method 1: Try different Hosting Service
To fix the error, “Error: error:0308010C:digital envelope routines::unsupported.”, you will have to delete the “proxy”: “http://localhost:6000”, you will have to For simple fix of the error, you can try to use HTTPS or a completely different hosting service. GitHub, GitLab, and Bitbucket all support secure methods of authentication.
Method 2: If you want to use SSH with AzureDevops
To fix the error, “Error: error:0308010C:digital envelope routines::unsupported.”, and you insist to use SSH with Azure DevOps at the moment, you can add the following code to your ~/.ssh/config
file in your project to work around this error:
Host ssh.dev.azure.com
User git
PubkeyAcceptedAlgorithms +ssh-rsa
HostkeyAlgorithms +ssh-rsa
Note: It should be noted that the approach we are using is a workaround and may be insecure, therefore you may contact Azure DevOps about this issue and follow method one as described above until they fix it, or you can migrate elsewhere.
This should fix the error “Error: error:0308010C:digital envelope routines::unsupported.”.
Conclusion
To fix the error “Error: error:0308010C:digital envelope routines::unsupported.”, you can try to use HTTPS or a completely different hosting service. GitHub, GitLab, and Bitbucket all support secure methods of authentication. You can also try to update you config file to use SSH but this is insecure.