git异常

1.异常现象
换机新安装 Git 后,拉代码时出现问题:

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

Please make sure you have the correct access rights
and the repository exists.

2.排查分析
从字面上理解,git 服务器端支持 diffie-hellman-group1-sha1 这种密钥交换方法,而 git 客户端不支持。

3.解决方案
跳到 .ssh 目录:

cd ~/.ssh
在C盘 “用户/当前用户名/.ssh/” 目录下新建一个 config 文件,无扩展名。然后使用写字板等工具打开,输入并保存以下内容:

Host *
KexAlgorithms +diffie-hellman-group1-sha1
或者,输入并保存以下内容(于2022年12月27日更新,感谢 qq_43255910 补充):

Host *
PubkeyAcceptedKeyTypes +ssh-rsa
HostKeyAlgorithms +ssh-rsa
————————————————
版权声明:本文为优快云博主「有时有味」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.youkuaiyun.com/itanping/article/details/104415899

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值