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

👲👲作者主页:🔗杰森的博客
📒📒本文摘要解决 GitHub 报错:ssh: connect to host github.com port 22: Connection refused
💖💖如果本文帮助到您,还请各位小伙伴👍点赞➕收藏⭐➕评论💭支持杰森呀✌️

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

报错信息:

$ 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.

方案一

日志:

$ 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

解决:

140.82.112.4 github.com
# Refreshing DNS configurations
$ ipconfig /flushdns

方案二

方案:

$ vim ~/.ssh/config
# Add the following configuration information
Host github.com
  Hostname ssh.github.com
  Port 443

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

$ 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 并删除便可解决。

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

$ ssh -T git@github.com
Hi xxx! You’ve successfully authenticated, but GitHub does not provide shell access.
  • 2
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 2
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

攻城狮杰森

感谢支持,杰森会继续努力哒

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值