关于 SSH send_pubkey_test no mutual signature algorithm 报错
背景
在 Windows 上 Git Bash 连接不上 gitlab 。同样的 SSH Key 在 macOS 上是可以用的。使用 ssh -v git@github.org 会报错:
1 | debug1: Next authentication method: publickey |
报错显示没有共同的签名算法。
排查
使用 ssh -vT git@github.com 命令可以 Debug :
1 | -v Verbose mode. |
macOS 上的版本:
1 | $ ssh -V |
Win 上的版本:
1 | $ ssh -V |
原因与方案
根据 OpenSSH to deprecate SHA-1 logins due to security risk,是 SHA-1 算法不安全,OpenSSH (8.8开始) 不再支持 ssh-rsa 公钥签名算法(public key signature algorithm)了。需要改用 ssh-ed25519 算法:
1 | $ ssh-keygen -t ed25519 -C "注释" -b 4096 |