当前位置: 首页 > article >正文

解决Error:You‘re using an RSA key with SHA-1, which is no longer allowed

一、问题

在微信开发者工具中,推送代码时发生错误Error:You‘re using an RSA key with SHA-1, which is no longer allowed......
奇怪的是命令行可以正常push:
在这里插入图片描述

在这里插入图片描述
在这里插入图片描述
原因:因为生成密钥的RSA算法,由于安全性原因,现在已经不允许使用了。
参考:Improving Git protocol security on GitHub
部分节选

Improving Git protocol security on GitHub We’re changing which keys
are supported in SSH and removing unencrypted Git protocol. Only users
connecting via SSH or git:// will be affected. If your Git remotes
start with https://, nothing in this post will affect you. If you’re
an SSH user, read on for the details and timeline.

译文:
改进GitHub上的Git协议安全性
我们正在更改SSH中支持的密钥,并删除未加密的Git协议。只有通过SSH或git://连接的用户才会受到影响。如果您的Git远程以https://开头,那么本文中的任何内容都不会影响您。如果您是SSH用户,请继续阅读以了解详细信息和时间表。

二、解决

//生成一个GitHub用的SSH-Key。
ssh-keygen -t rsa -C ‘123456@qq.com’ -f ~/.ssh/github_id_rsa

ssh-keygen命令中的rsa一种生成密钥的算法,也可以根据需求更换其他算法生成 ssh key
例如ssh-keygen -t ed25519 -C "your@example.email" 这里使用的就是ed25519算法, 之后到对应平台重新添加公钥即可

2.1 步骤与命令

因为生成密钥的RSA算法,由于安全性原因,现在已经不允许使用了。这里我们采用ECDSA算法来生成密钥。

//djc@qq.com"为示例邮箱,需要修改成自己个人注册并使用GitHub的主邮箱。
1、生成ECDSA密钥-二选一即可
//第一种:这种默认生成的公私钥名称为id_ecdsa.pub与id_ecdsa
//执行命令之后需要连续按3次回车键
//默认生成的公私钥id_ecdsa.pub与id_ecdsa文件位于C:\Users\JIACHENGER\.ssh目录下
ssh-keygen -t ecdsa -b 521 -C "djc@qq.com"

//第二种:这种指定了公私钥名称为github_id_ecdsa.pub与github_id_ecdsa 【我采用这种】
//执行命令之后需要连续按3次回车键
//生成的公私钥github_id_ecdsa.pub与github_id_ecdsa文件位于C:\Users\JIACHENGER\.ssh目录下
ssh-keygen -t ecdsa -b 521 -C "djc@qq.com"  -f ~/.ssh/github_id_ecdsa 

公私钥路径
C:\Users\JIACHENGER\.ssh\github_id_ecdsa 私钥路径
C:\Users\JIACHENGER\.ssh\github_id_ecdsa.pub  公钥路径


2、配置config中私钥的位置(如果同时配置了多个代码托管平台)
//将IdentityFile ~/.ssh/github_id_rsa 修改为 IdentityFile ~/.ssh/github_id_ecdsa
//表示不再使用RSA算法生成的key,而采用ecdsa算法生成的key。

3、在GitHub中设置公钥。
选择SSH and GPG keys,然后点击New SSH key ,将github_id_ecdsa.pub中的内容复制粘贴后保存。

4、检测
ssh -T git@github.com

5、再次使用微信开发者工具提交

2.2 步骤截图

1、生成ECDSA密钥:
在这里插入图片描述
在这里插入图片描述
2、配置config中私钥的位置(如果同时配置了多个代码托管平台):
#表示注释,不起作用,可删除。

##2023-12-6 18:42:42 配置使用刚刚生成ECDSA算法密钥  将 IdentityFile ~/.ssh/github_id_rsa 修改为    IdentityFile ~/.ssh/github_id_ecdsa

User git
 Host github.com    UpdateHostKeys yes
   Hostname github.com
   PreferredAuthentications publickey
  #IdentityFile ~/.ssh/github_id_rsa    2023-12-6 18:53:56注释此行表示失效,同时启用下面一行
   IdentityFile ~/.ssh/github_id_ecdsa

3、在GitHub中设置公钥
选择SSH and GPG keys,然后点击New SSH key ,将github_id_ecdsa.pub中的内容复制粘贴,输入GitHub账户正确的密码,确认权限后才能成功保存。
成功添加公钥github_id_ecdsa.pub完成后,ssh-keygen -t ecdsa -b 521 -C “djc@qq.com” -f ~/.ssh/github_id_ecdsa 中配置的邮箱djc@qq.com会收到相关提示,通知你A new SSH authentication public key was added to your account

过程可参考我这篇文章:GitHub&Gitee&Gitlab&极狐(JihuLab)同时生成并配置和检测不同SSH公私钥详细过程
中的 3.2 GitHub中配置公钥github_id_rsa.pub

4、检测 ssh -T git@github.com
在这里插入图片描述
在这里插入图片描述
5、再次使用微信开发者工具提交
成功在微信开发者工具中,推送push项目刚刚所做的提交到GitHub。
在这里插入图片描述
GitHub
在这里插入图片描述

三、相关参考

Improving Git protocol security on GitHub
生成新的 SSH 密钥并将其添加到 ssh-agent
GitHub&Gitee&Gitlab&极狐(JihuLab)同时生成并配置和检测不同SSH公私钥详细过程
git 出现 ERROR: You‘re using an RSA key with SHA-1, which is no longer allowed
GitHub推送报错:You‘re using an RSA key with SHA-1, which is no longer allowed


http://www.kler.cn/news/160489.html

相关文章:

  • 多关键字排序(java实训)
  • HarmonyOS4.0从零开始的开发教程04 初识ArkTS开发语言(下)
  • 机器学习---pySpark案例
  • 深入理解Vue.js中的this:解析this关键字及其使用场景
  • uniapp实战 —— 分类导航【详解】
  • 设置webstorm和idea符合Alibaba规范
  • 【Docker】从零开始:17.Dockerfile基本概念
  • 指定分隔符对字符串进行分割 numpy.char.split()
  • 自然语言处理(NLP)技术-AI生成版
  • Flinksql bug :Illegal mixing of types in CASE or COALESCE statement
  • 按天批量创建间隔分区表(DM8:达梦数据库)
  • 【PTA-C语言】编程练习4 - 数组Ⅰ
  • HarmonyOS4.0从零开始的开发教程08构建列表页面
  • 17、XSS——session攻击
  • 【动态规划】LeetCode-面试题 17.16. 按摩师
  • 配置阿里云CLI-aliyun命令与安装ossutil
  • 数据结构之交换排序
  • Flink优化——数据倾斜(二)
  • ssh远程连接服务器
  • ELK的日志解决方案
  • PACS源码,医学影像传输系统源码,全院级应用,支持放射、超声、内窥镜、病理等影像科室,且具备多种图像处理及三维重建功能
  • Kafka 的消息格式:了解消息结构与序列化
  • 2023字节跳动软件测试工程师面试题及答案分享
  • 万界星空科技MES系统在工业生产中的应用
  • WordPress发布文件随机设置作者昵称信息
  • gitlab高级功能之CI/CD组件 - 原理介绍(一)
  • Failed to connect to github.com port 443 after 21055 ms: Timed out
  • React Node.js 和 Prisma 构建全栈框架
  • gitLab 和Idea分支合并
  • 【Flink on k8s】- 5 - 简要介绍 Flink