前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >Git命令报错ERROR: 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.

作者头像
kongxx
发布2024-09-25 07:50:35
830
发布2024-09-25 07:50:35
举报

在Windows上使用Git命令clone项目的时候报错"ERROR: You're using an RSA key with SHA-1, which is no longer allowed.",具体错误如下:

代码语言:javascript
复制
$ git clone git@github.com:xxx/xxx.git
Cloning into 'xxx'...
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.

错误原因是github现在不再支持SHA-1的加密方式了。因此需要将SHA-1的加密方式修改为ECDSA的方式。

执行下面的命令生成ECDSA密钥

代码语言:javascript
复制
ssh-keygen -t ecdsa -b 521 -C "xxx@hotmail.com"

命令执行完成后会在~/.ssh目录中产生两个文件id_ecdsa和id_ecdsa.pub,分别为私钥和公钥。

我们将id_ecdsa.pub文件内容复制到 github -> Settings -> SSH and GPG keys -> New SSH Key

然后运行下面命令验证

代码语言:javascript
复制
$ ssh -T git@github.com

Hi kongxx! You've successfully authenticated, but GitHub does not provide shell access.

如果出现上面的提示,说明 ssh key 已经配置成功。

本文参与 腾讯云自媒体同步曝光计划,分享自作者个人站点/博客。
原始发表:2024-09-23,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体同步曝光计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档