SSH config配置多种HostKeyAlgorithms和

2023-06-20  本文已影响0人  SeanLink

https://www.jianshu.com/p/5c17d5e51855
上篇文章介绍了如何解决单个仓库报错的问题,但是目前github已经弃用了之前的老式RSA的key,某些情况下又要用到老式的key,这样你电脑里面就会包含老式和新式的两种key。
报错如下:

Cloning into 'xxxxx'...
git@github.com: Permission denied (publickey).
fatal: Could not read from remote repository.

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

这个时候你需要在你的SSH的config文件配置一下允许多种加密的方式,具体配置如下:

HostKeyAlgorithms ssh-ed25519,ssh-rsa,rsa-sha2-256,rsa-sha2-512
PubkeyAcceptedKeyTypes ssh-ed25519,ssh-rsa,rsa-sha2-256,rsa-sha2-512


Host github.com
  AddKeysToAgent yes
 ### 注意 这里使用的是私钥
  IdentityFile ~/.ssh/id_ed25519
  IgnoreUnknown UseKeychain

把这个配置到开头,剩下的host的一些配置你可以自己在自定义都可以
有些情况下可能需要吧ssh-rsa配置在最前面

HostKeyAlgorithms ssh-rsa,ssh-ed25519,rsa-sha2-256,rsa-sha2-512
PubkeyAcceptedKeyTypes ssh-rsa,ssh-ed25519,rsa-sha2-256,rsa-sha2-512
上一篇 下一篇

猜你喜欢

热点阅读