git 出现 ERROR: You‘re using an RSA key with SHA-1, which is no longer allowed

3 篇文章 0 订阅

1. 问题描述

git pull时(或git push, git clone等),出现如下问题。
在这里插入图片描述

2. 原因分析

原因是在2022年3月15日之后,github不再支持SHA-1的加密方式了。

3. 解决方案

将SHA-1的加密方式修改为ECDSA的方式,并把公钥加入到github中,具体操作步骤如下。

3.1 生成ECDSA密钥

执行如下命令。

ssh-keygen -t ecdsa -b 521 -C "your_email@example.com"

按照如下截图操作。
在这里插入图片描述
生成好了之后会在~/.ssh目录中看到多出两个文件id_ecdsaid_ecdsa.pub,分别为私钥和公钥。

3.2 打开github的SSH keys页面

从github的右上角点击向下的小箭头,然后选择Settings
在这里插入图片描述
选择SSH and GPG keys,然后点击New SSH key
在这里插入图片描述

3.3 在github中设置公钥。

首先执行命令gedit ~/.ssh/id_ecdsa.pub打开ECDSA的公钥,复制全部内容,粘贴到下边位置。
在这里插入图片描述

4. 参考资料

  1. https://stackoverflow.com/questions/71500791/eclipse-git-youre-using-an-rsa-key-with-sha-1-which-is-no-longer-allowed-pl
  2. https://exerror.com/youre-using-an-rsa-key-with-sha-1-which-is-no-longer-allowed-please-use-a-newer-client-or-a-different-key-type/
  3. github拉取代码报:You‘re using an RSA key with SHA-1, which is no longer allowed
  4. https://github.blog/2021-09-01-improving-git-protocol-security-github/
  • 15
    点赞
  • 36
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值