git 2.33+版本升级后ssh-rsa认证失效问题

一日,同事安装了2.33.1版本的git,生成密钥、gitlab账户绑定pubkey一气呵成后,发现pull代码时报错:

$ git pull
Unable to negotiate with 12.34.56.78 port 22: no matching host key type found. Their offer: ssh-rsa,ssh-dss
fatal: Could not read from remote repository.

而使用着2.32.0版本的我一切正常。
重装2.32版本后的确一切问题解决,但是为何2.33之后会出现这种问题?
在git-bash中使用ssh -V查看openssh版本,使用的版本是8.8p1

OpenSSH_8.8p1, OpenSSL 1.1.1l  24 Aug 2021
而2.32使用的是8.5p1
经过网上排查,发现8.8p1版本开始,客户端默认禁用了ssh-rsa,而我们的gitlab目前只支持ssh-rsa,所以只能在本地开启ssh-rsa的支持:
在本机~/.ssh/目录添加config文件,写入配置:
Host *
    HostKeyAlgorithms +ssh-rsa
    PubkeyAcceptedKeyTypes +ssh-rsa

 

转自:

https://www.jianshu.com/p/e5199f67cd84

https://www.cnblogs.com/Yinkaisheng/p/16192740.html

posted @ 2022-05-06 13:37  ck_2016  Views(439)  Comments(0Edit  收藏  举报