macOS ssh error: unable to negotiate with IP: no matching cipher

Posted MaMaFish

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了macOS ssh error: unable to negotiate with IP: no matching cipher相关的知识,希望对你有一定的参考价值。

环境:macOS Mojava version 10.14

在更新了Mac OS以后用ssh push 代码到服务器出现了下面这个错误。

ssh error: unable to negotiate with IP: no matching cipher found.Their offer: aes256-cbc,aes192-cbc,aes128-cbc... 

Unable to negotiate with XX.X.X.XXX port XX: no matching cipher found. Their offer: aes256-cbc,aes192-cbc,aes128-cbc
fatal: Could not read from remote repository.

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

出现错误的原因是要连接的代码仓库服务端的ssh版本过低,客户端与服务端的 cipher 没有匹配上,我们需要在自己的客户端(升级OS后的Mac)重新启用老的 cipher ,这样就能重新建立起连接了。

具体步骤如下:

第一步:terminal 输入 sudo nano /etc/ssh/ssh_config 

atcs-air:~ XXX$ sudo nano /etc/ssh/ssh_config

第二步:找到 Ciphers aes128-ctr,aes192-ctr,aes256-ctr,aes128-cbc,3des-cbc,删除这行前面的#号。

# Host *
#   ForwardAgent no
#   ForwardX11 no
#   PasswordAuthentication yes
#   HostbasedAuthentication no
#   GSSAPIAuthentication no
#   GSSAPIDelegateCredentials no
#   BatchMode no
#   CheckHostIP yes
#   AddressFamily any
#   ConnectTimeout 0
#   StrictHostKeyChecking ask
#   IdentityFile ~/.ssh/id_rsa
#   IdentityFile ~/.ssh/id_dsa
#   IdentityFile ~/.ssh/id_ecdsa
#   IdentityFile ~/.ssh/id_ed25519
#   Port 22
#   Protocol 2
   Ciphers aes128-ctr,aes192-ctr,aes256-ctr,aes128-cbc,3des-cbc
#   MACs hmac-md5,hmac-sha1,umac-64@openssh.com
#   EscapeChar ~
#   Tunnel no
#   TunnelDevice any:any
#   PermitLocalCommand no
#   VisualHostKey no
#   ProxyCommand ssh -q -W %h:%p gateway.example.com
#   RekeyLimit 1G 1h

Host *
        SendEnv LANG LC_*

第三步:保存 ssh_config 这个文件,退出。然后就可以和以前一样通过ssh连接代码仓库服务器了。

参考链接:
https://www.itechlounge.net/2...

https://discussions.apple.com...

以上是关于macOS ssh error: unable to negotiate with IP: no matching cipher的主要内容,如果未能解决你的问题,请参考以下文章

windows下Python扩展问题error: Unable to find vcvarsall.bat

使用github出了些问题?fatal: unable to access;Failed connect to github.com:8087; No error

macos解决Hadoop之Unable to load native-hadoop library

EF Core Error:Unable to cast object of type ‘System.DBNull‘ to type ‘System.String‘

安装macOS时遇到Unable to unmount volume for repair异常导致无法完成安装的解决办法

error: Unable to find vcvarsall.bat