github报错”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…“

使用git上传代码,报错内容如下:

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.

问题原因:
github对秘钥进行升级,导致RSA不再支持。

解决方法:
(1)第一步,生成新的秘钥:
ssh-keygen -t ecdsa -b 521 -C "[email protected]"
新秘钥的位置在/home/你的用户名/.ssh文件夹下,新文件名称:

  • id_ecdsa(私钥,一般不用)
  • id_ecdsa.pub(公钥,用于将其添加到github中的ssh-key中)

(2)在github中删除旧的ssh秘钥,添加id_ecdsa.pub为新的秘钥
note:之前没有删除旧的秘钥,会仍旧报错
(3)为了保险起见,将旧的秘钥改名做了备份。

你可能感兴趣的:(工具箱,github)