windows下使用git pull报错

报错内容:

Unable to negotiate with x.x.x.x 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.

 

已经在服务器上添加了windows电脑的公钥,刚开始一段时间,是能正常使用的,但是突然之间,windows上无法更新代码了。

 

解决:

C:\Users\Administrator\.ssh (这是我的电脑上的路径,你们的电脑路径可能不一样,根据具体情况来找)

在该目录下新增文件 config,文件内容为:

Host x.x.x.x
    HostkeyAlgorithms +ssh-rsa
    PubkeyAcceptedAlgorithms +ssh-rsa

注意,这里的x.x.x.x代表的是你的git服务器的IP地址。

 

重新拉取代码,此时就恢复了。

posted @ 2021-11-23 13:54  道霖  阅读(225)  评论(0编辑  收藏  举报