记录github ssh 下载代码失败解决过程

发布时间 2023-05-08 12:44:29作者: pmh905001
  • windows机器下载airflow代码失败:
$ git clone git@github.com:apache/airflow.git
Cloning into 'airflow'...
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED! @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY!
Someone could be eavesdropping on you right now (man-in-the-middle attack)!
It is also possible that a host key has just been changed.
The fingerprint for the RSA key sent by the remote host is
SHA256:XXXXXXXXXXXXXXXXXXXXXXX.
Please contact your system administrator.
Add correct host key in /c/Users/Administrator/.ssh/known_hosts to get rid of this message.
Offending RSA key in /c/Users/Administrator/.ssh/known_hosts:1
RSA host key for github.com has changed and you have requested strict checking.
Host key verification failed.
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

 

  • C:\Users\Administrator\.ssh\known_hosts文件看起来有问题, 剪切到其他目录备份。再次重新执行变成了其他错误:
$ git clone git@github.com:apache/airflow.git
Cloning into 'airflow'...
The authenticity of host 'github.com (20.205.243.166)' can't be established.
ECDSA key fingerprint is SHA256:XXXXXXXXXXXXXXXXXXXXXX
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'github.com,20.205.243.166' (ECDSA) to the list of known hosts.
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 不再支持rsa SHA-1. 找到这篇文章  https://blog.csdn.net/wangpaiblog/article/details/124416005。

查看C:\Users\Administrator\.ssh目录下的文件,已经存在id_ed25519,id_ed25519.pub。 删除老的key,将id_ed25519.pub文件的内容粘贴到new ssh key

https://github.com/settings/keys 

 

 

  • 再次执行,成功
$ git clone git@github.com:apache/airflow.git
Cloning into 'airflow'...
The authenticity of host 'github.com (20.205.243.166)' can't be established.
ECDSA key fingerprint is SHA256:XXXXXXXXXXXXX.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'github.com,20.205.243.166' (ECDSA) to the list of known hosts.
remote: Enumerating objects: 313044, done.
remote: Counting objects: 100% (15710/15710), done.
remote: Compressing objects: 100% (1845/1845), done.
remote: Total 313044 (delta 15198), reused 14019 (delta 13862), pack-reused 297334
Receiving objects: 100% (313044/313044), 229.86 MiB | 143.00 KiB/s, done.
Resolving deltas: 100% (232184/232184), done.
Checking connectivity... done.
Checking out files: 100% (7228/7228), done.