ssh: connect to host github.com port 22: Connection refused是连接github.com的端口号22拒绝连接
22端口拒绝连接,我们可以使用443端口号进行连接
解决方案
- 打开git bash窗口
- 输入vim ~/.ssh/config
- 添加如下字段
如果没有config 文件就新建一个 Host github.com Hostname ssh.github.com Port 443
- 测试连接
如果出现以下内容,输入yes即可ssh -T [email protected]
The authenticity of host ‘[ssh.github.com]:443 ([20.205.243.160]:443)’ can’t be established.
ECDSA key fingerprint is SHA256:p2QAMXNIC1TJYWeIOttrVc98/R1BUFWu3/LiyKgUfQM.
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
最终显示Hi chengyun-pg! You’ve successfully authenticated, but GitHub does not provide shell access.,可能会比较慢,耐心等待。