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

发布时间:2024年01月13日

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. 测试是否链接成功
ssh -T git@github.com

如果出现如下字段则验证成功
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.

文章来源:https://blog.csdn.net/m0_73790534/article/details/135577136
本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。