背景: 换了台电脑,github上的代码clone失败(已经添加了公钥的情况下)
运行 $ ssh -T git@github.com
The authenticity of host 'github.com (20.205.243.166)' can't be established.
ED25519 key fingerprint is SHA256:+DiY3wvvV6TuJJhbpZisF/zLDA0zPMSvHdkr4UvCOqU.
This key is not known by any other names
可以运行 ssh -T git@github.com -v
看看debug过程
运行 ssh-keyscan github.com >> ~/.ssh/known_hosts
将 GitHub 的主机密钥添加到 known_hosts
文件中
然后再试$ ssh -T git@github.com
就可以发现成功了!