在克隆阿里云代码时报了下方的错

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

在网上搜一波都是让生成ssh公钥然后部署到服务器上,然后折腾一晚上,以为就是这个问题,但还是不行。

后来发现原来是当时本来本地已经有生成过公钥了,但我怕重复,所以删掉了以前的,还连着删了几个其他文件,无语!

原因可能是新的ssh客户端不支持ssh-rsa算法,要修改本地配置重新使用ssh-rsa算法

解决方法:

在生成公钥的文件夹里(一般在当前用户目录下的.ssh文件中)创建一个config文件(没有后缀),用文本文档格式打开,添加下方内容

Host *
HostkeyAlgorithms +ssh-rsa
PubkeyAcceptedKeyTypes +ssh-rsa

 

保存

然后再试克隆仓库,成了!

Logo

瓜分20万奖金 获得内推名额 丰厚实物奖励 易参与易上手

更多推荐