前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >ssh: connect to host github.com port 22: Connection refused

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

作者头像
攻城狮杰森
发布2022-07-09 08:53:23
1K0
发布2022-07-09 08:53:23
举报
文章被收录于专栏:技术集锦技术集锦

👲👲作者主页:🔗杰森的博客 📒📒本文摘要:解决 GitHub 报错:ssh: connect to host github.com port 22: Connection refused

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

报错信息:

代码语言:javascript
复制
$ git clone git@github.com:appletdevelop/full-stack.git
Cloning into ‘full-stack’...
ssh: connect to host github.com port 22: Connection refused
fatal: Could not read from remote repository.

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

方案一

日志:

代码语言:javascript
复制
$ ssh -vT git@github.com
OpenSSH_9.0p1, OpenSSL 1.1.1o  5 July 2022
debug1: Reading configuration data /c/Users/jason/.ssh/config
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Connecting to github.com [::1] port 22.
debug1: connect to address ::1 port 22: Connection refused
debug1: Connecting to github.com [127.0.0.1] port 22.
debug1: connect to address 127.0.0.1 port 22: Connection refused
ssh: connect to host github.com port 22: Connection refused

解决:

代码语言:javascript
复制
140.82.112.4 github.com
# Refreshing DNS configurations
$ ipconfig /flushdns

方案二

方案:

代码语言:javascript
复制
$ vim ~/.ssh/config
# Add the following configuration information
Host github.com
  Hostname ssh.github.com
  Port 443

测试访问是否成功,通常不出意外的话意外就来了……

代码语言:javascript
复制
$ ssh -T git@github.com
The authenticity of host ‘[ssh.github.com]:443([unknown ip address]:443)’ can’t be established.
xxx key fingerprint is xxx:xxx.
This host key is known by the following other names/addresses:
    # Delete the RSA information in line 8
    ~/.ssh/known_hosts:8: github.com
Host key verification failed.

这与 ssh 的运行机制有关,找到 known_hosts 文件中对应 ipRSA 并删除便可解决。

再次测试,看到以下信息则表示访问成功

代码语言:javascript
复制
$ ssh -T git@github.com
Hi xxx! You’ve successfully authenticated, but GitHub does not provide shell access.
本文参与 腾讯云自媒体同步曝光计划,分享自作者个人站点/博客。
原始发表:2022-07-08,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体同步曝光计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • ssh: connect to host github.com port 22: Connection refused
    • 方案一
      • 方案二
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档