河南移动官网网站建设,网站开发运营维护方案建议,天津工商网上办事大厅,网站建设的收费一、问题
在微信开发者工具中#xff0c;推送代码时发生错误Error:You‘re using an RSA key with SHA-1, which is no longer allowed...... 奇怪的是命令行可以正常push: 原因#xff1a;因为生成密钥的RSA算法#xff0c;由于安全性原因#xff0c;现在已经不允许使用…一、问题
在微信开发者工具中推送代码时发生错误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 ‘123456qq.com’ -f ~/.ssh/github_id_rsassh-keygen命令中的rsa是一种生成密钥的算法也可以根据需求更换其他算法来生成 ssh key。 例如ssh-keygen -t ed25519 -C yourexample.email 这里使用的就是ed25519算法 之后到对应平台重新添加公钥即可
2.1 步骤与命令
因为生成密钥的RSA算法由于安全性原因现在已经不允许使用了。这里我们采用ECDSA算法来生成密钥。
//djcqq.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 djcqq.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 djcqq.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 gitgithub.com5、再次使用微信开发者工具提交
2.2 步骤截图
1、生成ECDSA密钥 2、配置config中私钥的位置如果同时配置了多个代码托管平台 #表示注释不起作用可删除。
##2023-12-6 18:42:42 配置使用刚刚生成ECDSA算法密钥 将 IdentityFile ~/.ssh/github_id_rsa 修改为 IdentityFile ~/.ssh/github_id_ecdsaUser gitHost github.com UpdateHostKeys yesHostname github.comPreferredAuthentications publickey#IdentityFile ~/.ssh/github_id_rsa 2023-12-6 18:53:56注释此行表示失效同时启用下面一行IdentityFile ~/.ssh/github_id_ecdsa3、在GitHub中设置公钥 选择SSH and GPG keys,然后点击New SSH key 将github_id_ecdsa.pub中的内容复制粘贴输入GitHub账户正确的密码确认权限后才能成功保存。 成功添加公钥github_id_ecdsa.pub完成后ssh-keygen -t ecdsa -b 521 -C “djcqq.com” -f ~/.ssh/github_id_ecdsa 中配置的邮箱djcqq.com会收到相关提示通知你A new SSH authentication public key was added to your account。
过程可参考我这篇文章GitHubGiteeGitlab极狐(JihuLab)同时生成并配置和检测不同SSH公私钥详细过程 中的 3.2 GitHub中配置公钥github_id_rsa.pub
4、检测 ssh -T gitgithub.com 5、再次使用微信开发者工具提交 成功在微信开发者工具中推送push项目刚刚所做的提交到GitHub。 GitHub
三、相关参考
Improving Git protocol security on GitHub 生成新的 SSH 密钥并将其添加到 ssh-agent GitHubGiteeGitlab极狐(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