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 已经配置成功。

相关推荐
wj3055853781 小时前
Codex + Git 开发环境配置指南(WSL版)
linux·运维·git
楠枬4 小时前
Git 分支管理
git
奇怪的点6 小时前
git clone失败
git
WaiSaa6 小时前
Ubuntu配置Git免密操作
git·ubuntu·gitee
牛奶咖啡136 小时前
Git实践——分支管理与标签管理及git个性化配置
git·禁用 fast forward·bug分支的创建与操作·远程分支的查看与推送·拉取仓库·推送指定分支到远程仓库·标签的创建与操作
千寻girling10 小时前
五一劳动节快乐 [特殊字符][特殊字符][特殊字符]
java·c++·git·python·学习·github·php
波特率11520010 小时前
git指令学习
git·学习
Karry_66611 小时前
[特殊字符] Git 提交项目 全套命令(按顺序执行)
git
计算机安禾11 小时前
【Linux从入门到精通】第39篇:版本控制Git服务器搭建——Gitea/GitLab私有化部署
linux·服务器·git
lst042612 小时前
Git 巨大失误案例记录 (2026-05-01)
大数据·git·elasticsearch