ssh: connect to host github.com port 22: Connection refused
原创
©著作权归作者所有:来自51CTO博客作者董哲朋Jason的原创作品,请联系作者获取转载授权,否则将追究法律责任
👲👲作者主页:🔗杰森的博客 📒📒本文摘要:解决 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
方案一
日志:
$ 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
方案二
方案:
$ 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
文件中对应 ip
的 RSA
并删除便可解决。
再次测试,看到以下信息则表示访问成功
$ ssh -T git@github.com
Hi xxx!