After updating VS 2022 to 17.1.1, I have a problem with Git. I can't comment, for example, fetch or pusl. I get a message
Fetching from origin Unable to negotiate with {0} port {1}: no matching host key type found. Their offer: ssh-rsa Failed to fetch from the remote repository. See the Output window for more details. Error encountered while fetching: Failed to fetch from the remote repository. See the Output window for more details.
However, on VS 2019 it works fine, and in SourceTree I can make any comments. So it's not a problem with buggy ssh-rsa.
How can I solve it?
CodePudding user response:
This also happened to me today when I upgraded to the latest version in VS 2019 Community Edition (but the IP address and port of the previously configured Git connection appeared for me).
Visual Studio IDE has an own Git extension. Try to search for that instance in the folder hierarchy and under it the ssh configuration file (e.g. in VS2019 Community Edition: %PROGRAMFILES(x86)%\Microsoft Visual Studio\2019\Community\Common7\IDE\CommonExtensions\Microsoft\TeamFoundation\Team Explorer\Git\etc\ssh\ssh_config). Add this configuration to the end of this file with the appropriate git server hostname or IP address or both separated by space (to enable the deprecated/insecure encryption at client side):
Host gitserver.local
HostkeyAlgorithms ssh-rsa
PubkeyAcceptedAlgorithms ssh-rsa
This was the solution for me.
There may be another solution to upgrade the Git server-side to support more secure encryptions (e.g. rsa-sha2-256 or 512).