Mac更新到macOS 10.15后ssh无响应

代码是托管到gerrit上的,本来用的好好的git pull 结果在更新完mac os后不能提交了。对比Ubuntu依然可以提交。和管理员沟通说是无线的问题,换成有线试试。买了一个带网口的转接头试了试真的可以,但好景不长,出现了同样的问题。

问题现象

ssh gerrit-mirror 无任何的输出。加上-v之后可以看到ssh走到某一步停了。

解决过程

一. 更新home brew版本。

直接home brew 发现太慢。搜索之后需要换brew源。
1)替换brew.git:
cd "(brew --repo)/Library/Taps/homebrew/homebrew-core"
git remote set-url origin https://mirrors.aliyun.com/homebrew/homebrew-core.git

注意:如果 homebrew-core 不存在
git clone git://mirrors.ustc.edu.cn/homebrew-core.git/ /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core --depth=1

3)替换homebrew-bottles:
echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.aliyun.com/homebrew/homebrew-bottles' >> ~/.bashrc
source ~/.bashrc
4)替换homebrew-cask.git:
cd "$(brew --repo)"/Library/Taps/homebrew/homebrew-cask
git remote set-url origin https://mirrors.ustc.edu.cn/homebrew-cask.git

5)brew update

当然如果之前没有设置过brew,需要安装一下:
bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"

二.更新ssh

brew install openssh
更新后的版本:

ssh -V
OpenSSH_8.2p1, OpenSSL 1.1.1g 21 Apr 2020

三,解决no matching key exchange method found.

经过一,二两步后就可以ssh gerrit-mirror,但是提交代码依然报错:

no matching key exchange method found. Their offer: diffie-hellman-group14-sha1,diffie-hellman-group1-sha1
fatal: Could not read from remote repository.

解决办法,在.ssh/config 文件里添加这两行。
Host *
KexAlgorithms +diffie-hellman-group1-sha1

你可能感兴趣的:(Mac更新到macOS 10.15后ssh无响应)