admin管理员组

文章数量:1630586

github 报错提示 ERROR: You're using an RSA key with SHA-1,RSA不能用,需要升级

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.

解决办法:

# 生成新秘钥,如果报错 unknown key type ed25519,使用这个:ssh-keygen -t ecdsa -b 521 -C "your_email@example",一路回车(第一个回车是生成秘钥的名字,不给就默认,后两个是密码,可以不要)
$ ssh-keygen -t ed25519 -C "your_email@example"

# 启动 ssh 代理,根据环境,使用不同的命令
$ eval "$(ssh-agent -s)"

# 将秘钥添加到代理中,如果还有其他以前秘钥,也要添加进去
$ ssh-add id_ed25519

# 查看秘钥,并复制粘贴到GitHub
$ cat ~/.ssh/id_ed25519.pub

# 测试,最好是拉取一个项目看看,可不可以访问
$ ssh -T git@github

log

(pytorch) [yudong@admin1 Temp]$ git pull
ERROR: You are 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.
# 生成秘钥
(pytorch) [yudong@admin1 .ssh]$ ssh-keygen -t ecdsa -b 521 -C "ydduong@163"
Generating public/private ecdsa key pair.
Enter file in which to save the key (/public/home/yudong/.ssh/id_ecdsa): 
Enter passphrase (empty for no passphrase): 
Enter same passphrase again: 
Your identification has been saved in /public/home/yudong/.ssh/id_ecdsa.
Your public key has been saved in /public/home/yudong/.ssh/id_ecdsa.pub.
The key fingerprint is:
7a:3b:30:d8:b5:a3:5d:c7:85:8b:82:b6:75:2a:d8:fc ydduong@163
The key's randomart image is:
+--[ECDSA  521]---+
|                 |
|                 |
|             .   |
|        .   . .  |
|     o oS. o o   |
|    . *.= + +    |
|     =.B.* .     |
|    . *.+.       |
|       oE.       |
+-----------------+
(pytorch) [yudong@admin1 .ssh]$ ls
authorized_keys  config  id_ecdsa  id_ecdsa.pub  id_rsa  id_rsa.pub  known_hosts
# 启动shh代理
(pytorch) [yudong@admin1 .ssh]$ eval "$(ssh-agent -s)"
Agent pid 210477
# 添加代理
(pytorch) [yudong@admin1 .ssh]$ ssh-add id_ecdsa
Identity added: id_ecdsa (id_ecdsa)
(pytorch) [yudong@admin1 .ssh]$ ssh-add id_rsa
Identity added: id_rsa (id_rsa)
# 查看公钥
(pytorch) [yudong@admin1 .ssh]$ cat id_ecdsa.pub 
ecdsa-sha2-nistp521 AAAAE2VjZHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXkfa6XXXqOS62um3j8ZOXVdabpGwCRCVBLlxMNfmNPRNG2FEl3rkxpw2O91MAINv+JiXPU56sA== ydduong@163
# 测试
(pytorch) [yudong@admin1 .ssh]$ ssh -T git@github
Hi ydduong! You have successfully authenticated, but GitHub does not provide shell access.
(pytorch) [yudong@admin1 .ssh]$ cd ../Temp/
# 测试
(pytorch) [yudong@admin1 Temp]$ git pull
remote: Enumerating objects: 10, done.
remote: Counting objects: 100% (9/9), done.
remote: Compressing objects: 100% (3/3), done.
remote: Total 6 (delta 3), reused 6 (delta 3), pack-reused 0
Unpacking objects: 100% (6/6), done.
From github:ydduong/Temp
   5e7379d..aec2a53  main       -> origin/main
Updating 5e7379d..aec2a53
Fast-forward
 Snipaste_2022-03-25_23-26-58.png | Bin 0 -> 238594 bytes
 plt.py                           |  65 +++++++++++++++++++++++++++++++++++++++++++++++++----------------
 2 files changed, 49 insertions(+), 16 deletions(-)
 create mode 100644 Snipaste_2022-03-25_23-26-58.png
(pytorch) [yudong@admin1 Temp]$ 

本文标签: 报错提示GitHubErrorSHA