github push 出现connection refused 的处理办法

针对公网上的服务器的检查,在日志中会发现大量针对22端口(ssh)的非法扫描。为了增强安全性,减少这些扫描,我们将服务器的ssh端口改成了一个非标准的端口。

这时,连接github时,会出现错误,无法连接:

#git pull
ssh: connect to host github.com port xxxxx: Connection refused
fatal: The remote end hung up unexpectedly

解决方法,编辑一个 ssh 的config文件:

$vim ~/.ssh/config
Host github.com
HostName github.com
Port 22

测试一下:

$ssh  -T [email protected]
Hi pubyun! You've successfully authenticated, but GitHub does not provide shell access.
$git pull
Current branch master is up to date.

你可能感兴趣的:(git)