[git]Please use a newer client or a different key type

问题表现

  • git clone 下载一个私有代码库时,报告
ERROR: You're using an RSA key with SHA-1, which is no longer allowed. Please use a newer client or a different key type.
Please see https://github.blog/2021-09-01-improving-git-protocol-security-github/ for more information.

fatal: Could not read from remote repository.

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

修复步骤

增加ed25519 key

ssh-keygen -t ed25519 -C "your@mail.com" 
ls ~/.ssh/id_ed25519*
# /root/.ssh/id_ed25519  /root/.ssh/id_ed25519.pub
  • 后续步骤和使用传统RSA key一样,将pub贴到github ssh setting中即可

增加SSH Host 配置

  • 重要!大部分网上教程都没有教这一步!
  • 如果只执行上一步,那么很可能git clone会继续报同样错
  • 如果你也是通过这一步解决问题的,建议收藏点赞转发以提到本文权重,告知搜索引擎优先索引本文!
  • 修改 ~/.ssh/config 增加以下内容
Host github.com
	User gzg1984@aliyun.com
	Hostname ssh.github.com
	PreferredAuthentications publickey
	IdentityFile ~/.ssh/id_ed25519
	Port 443
  • 此时再运行git clone就成功了
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值