git clone代码时提示:no matching key exchange method found

最近接受一个新项目在使用git clone克隆代码时,遇到了如下错误:

Unable to negotiate with xxx.xxx.xxx.xxx: no matching key exchange method found. Their offer: diffie-hellman-group1-sha1
fatal: Could not read from remote repository.

从提示来看,这个应该是server的key exchange方法无法匹配导致的。而server支持的算法是:diffie-hellman-group1-sha1。所以此处应该将client端的算法强制使用diffie-hellman-group1-sha1

所以此处需要在~/.ssh/config当中添加如下配置:

host xxx.xxx.xxx.xxx #服务器ip地址
    KexAlgorithms diffie-hellman-group1-sha1
    identityfile ~/.ssh/xxx.pub #如果不是默认的公钥,此处需要指定一下

之后再次执行git clone命令就可以正常执行了。

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值