当前位置:   article > 正文

解决ssh: connect to host github.com port 22: Connection refused_git ssh:connect to host port 22:connection refused

git ssh:connect to host port 22:connection refused

ssh: connect to host github.com port 22: Connection refused 是连接github.com的端口号22拒绝连接。

可以使用github的443端口

解决方案

  1. ~/.ssh/config中添加如下字段:
$ vim ~/.ssh/config
# 如果没有config 文件就新建一个
Host github.com
  Hostname ssh.github.com
  Port 443
  • 1
  • 2
  • 3
  • 4
  • 5
  1. 测试是否链接成功
ssh -T git@github.com
  • 1

如果出现如下字段则验证成功
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
Warning: Permanently added ‘[ssh.github.com]:443,[20.205.243.160]:443’ (ECDSA) to the list of known hosts.
Hi githubName! You’ve successfully authenticated, but GitHub does not provide shell access.

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/我家自动化/article/detail/557704
推荐阅读
相关标签
  

闽ICP备14008679号