最详细解决Unable to negotiate with XXX port :no matching host key type found.Their offer: ssh-rsa,ssh-dss

1、切换为root用户

执行   cd /

2、

执行  cd ~      #切换到用户主目录
然后执行  ls -a   #查看隐藏文件
看是否有 .ssh 文件夹

最详细解决Unable to negotiate with XXX port :no matching host key type found.Their offer: ssh-rsa,ssh-dss

 

3、如果没有.ssh文件夹

 

执行   mkdir ~/.ssh   #创建该文件

4、如果有.ssh文件夹

 

执行   ls -a ~/.ssh  #查看.ssh文件夹下有没有  config  文件

5、如果没有config文件

 

执行   touch ~/.ssh/config    #创建该文件

6、如果有config文件

 

#以下是配置

Host *
HostkeyAlgorithms +ssh-rsa
PubkeyAcceptedKeyTypes +ssh-rsa



如果您使用的是 vi 编辑器,可以按照以下步骤将上述配置写入 ~/.ssh/config 文件

1、打开 ~/.ssh/config 文件:

vi ~/.ssh/config

2、按 i 进入插入模式,在此之前请先复制上述配置,然后粘贴进去

3、按下Esc键,键盘输入  :wq!  并按 Enter      #强制保存并退出  

4、确保在编辑完成后对 ~/.ssh/config 文件进行适当的权限设置,以保护其中的敏感信息:

chmod 600 ~/.ssh/config    #设置为具有读写权限

最详细解决Unable to negotiate with XXX port :no matching host key type found.Their offer: ssh-rsa,ssh-dss

然后再去试试git是否可以正常拉取和提交

本文来自网络,不代表协通编程立场,如若转载,请注明出处:https://net2asp.com/06447a70cd.html