【Github】ssh: connect to host github.com port 22: Connection refused

ssh: connect to host github.com port 22: Connection refused

近日在进行push的时候出现以下错误:

$ git push
ssh: connect to host github.com port 22: Connection timed out
fatal: Could not read from remote repository.

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

解决思路:
参考资料:

  • 坑:ssh: connect to host github.com port 22: Connection refused
  • 关于本地git通过ssh链接github时 time out问题的解决方法
    找到.ssh文件夹:
    【Github】ssh: connect to host github.com port 22: Connection refused_第1张图片
    查看是否有config文件,如果没有,新建一个!并添加如下内容:
Host github.com
  Hostname ssh.github.com
  Port 443

然后保存,Git中输入一下密令:

ssh -T [email protected]

【Github】ssh: connect to host github.com port 22: Connection refused_第2张图片
使用ssh -T [email protected]来测试和GitHub的网络通信是否正常,如果提示Hi xxxxx! You’ve successfully authenticated, but GitHub does not provide shell access. 就表示一切正常了。

然后就可以正常上传了。

你可能感兴趣的:(Github,github,ssh,运维)