Git命令报错ERROR: You‘re using an RSA key with SHA-1, which is no longer allowed.

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

shell 复制代码
$ 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密钥

shell 复制代码
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

然后运行下面命令验证

shell 复制代码
$ ssh -T git@github.com

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

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

相关推荐
全栈陈序员2 小时前
【Git】从入门到精通(七)—— git status:查看仓库状态
大数据·git·elasticsearch
莫晓燚7 小时前
Ansible 13 个常用模块---企业实战
git·github
无言听风雨丶13 小时前
Kubernetes GitOps 持续交付实战:用 Argo CD 让 Git 成为集群事实源
git·elasticsearch·kubernetes
全栈陈序员14 小时前
【Git】从入门到精通(六)—— git commit:提交到版本库
大数据·git·elasticsearch
全栈陈序员1 天前
【Git】从入门到精通(一)—— Git简介:什么是版本控制系统
大数据·git·elasticsearch
大猫会长1 天前
git笔记
git
克里斯蒂亚诺更新1 天前
git引入其他分支并且合并
git
全栈陈序员1 天前
【Git】从入门到精通(二)—— Git安装与初次配置
数据仓库·git
XLYcmy2 天前
实验报告分析评价文档——《第四次阶段汇报:模型产物的仓库瘦身、云端部署与评测链路打通》评析
git·llm·cpu·gpu·反编译·反汇编·safetensors
全栈陈序员2 天前
【Git】从入门到精通(三)—— 创建第一个Git仓库
大数据·git·elasticsearch