我的操作系统是windows10,今天拉代码时,git突然报错:
Unable to negotiate with xx.xx.xx.xx port xxxx: 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.
后来重新生成了Key值 更新到git服务器上也还是不能访问。查了一些资料后 发现是openSSH报的错,不是本地git和服务器的原因。 解决方案如下: 在.ssh文件夹(一般路径都是C:/Users/你的用户名/.ssh)里新建一个config文件。windows下默认应该是没有这个文件的得自己新建,最后不要加后缀 直接命名成 config 使用文本编辑器编辑即可。输入以下内容:
Host xxx.xxx.com(不一定非得写git服务器名 写 * 也行)
HostKeyAlgorithms +ssh-rsa
PubKeyAcceptedKeyTypes +ssh-rsa
保存后 重启git, 即可解决。