github Error: ERROR: You're using an RSA key with SHA-1
,RSA can not used and need to upgrade:
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.
Solution:
# Generate a new secret key, if you report an error unknown key type ed25519, use this: ssh-keygen -t ecdsa -b 521 -C "[email protected]", all the way back to the car (the first carriage return is the name of the generated secret key, do not give the default, the last two are the password, you can do without)
$ ssh-keygen -t ed25519 -C "[email protected]"
# start ssh proxy, use different commands depending on the environment
$ eval "$(ssh-agent -s)"
# Add the secret key to the agent, and if there are other previous secret keys, add them too
$ ssh-add id_ecdsa
# View the secret key and copy and paste it to GitHub
$ cat ~/.ssh/id_ecdsa
# Test, it's best to pull a project to see if it can be accessed
$ ssh -T [email protected]
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 "[email protected]"
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 [email protected]
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
# start shh proxy
(pytorch) [yudong@admin1 .ssh]$ eval "$(ssh-agent -s)"
Agent pid 210477
# add proxy
(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)
# check the public key
(pytorch) [yudong@admin1 .ssh]$ cat id_ecdsa.pub
ecdsa-sha2-nistp521 AAAAE2VjZHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXkfa6XXXqOS62um3j8ZOXVdabpGwCRCVBLlxMNfmNPRNG2FEl3rkxpw2O91MAINv+JiXPU56sA== [email protected]
# test
(pytorch) [yudong@admin1 .ssh]$ ssh -T [email protected]
Hi ydduong! You have successfully authenticated, but GitHub does not provide shell access.
(pytorch) [yudong@admin1 .ssh]$ cd ../Temp/
# test
(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.com: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]$