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,[email protected]
#   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...

你可能感兴趣的:(git)