升级gitlab主机的版本:OpenSSH_8.0p1 ,导致远端的服务器无法通过sftp传输文件到gitlab服务器,发现是远端的服务器ssh版本太低,而新升级版本OpenSSH_8.0p1的服务器已经不再支持老版本ssh client的相关协议,这时候有两种解决办法,一种是升级远端服务器的openssh client版本,一种是修改升级后的服务器配置文件使其支持旧版本的协议,当然采用第二种方法自己解决问题。
sshd -T | grep kex
kexalgorithms curve25519-sha256,curve25519-sha256@libssh.org,ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group16-sha512,diffie-hellman-group18-sha512,diffie-hellman-group14-sha256,diffie-hellman-group14-sha1
#vim /etc/ssh/sshd_config
KexAlgorithms diffie-hellman-group1-sha1,diffie-hellman-group14-sha1,diffie-hellman-group-exchange-sha1,diffie-hellman-group-exchange-sha256,ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group1-sha1,curve25519-sha256@libssh.org
#service sshd restart
基本上到这里就解决问题了。
也记录一下如果还有问题的排查
执行命令:sudo passwd -u git
强制执行命令:sudo passwd -u -f git
[root@hostname ~]# sudo passwd -u git
Unlocking password for user git.
passwd: Warning: unlocked password would be empty.
passwd: Unsafe operation (use -f to force)
[root@hostname ~]# sudo passwd -u -f git
Unlocking password for user git.
passwd: Success
在尝试执行命令:
#git clone git@gitlab.xxx.com:weiliyan/test.git
就可以免密远程下载项目到本地了
本文参考:
https://blog.csdn.net/duanbiren123/article/details/103034914
https://www.cnblogs.com/shansongxian/p/6616954.html