【ssh】解决port 22:connection time out

文章讲述了作者在使用gitclone时遇到SSH连接GitHub的超时错误,通过检查SSH配置、添加SSH密钥并修改config文件,解决了连接问题,确保了与GitHub的正常通信。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

突然git clone报错了,之前没遇到过,记录一下

报错信息:

ssh: connect to host github.com port 22: Connection timed out
Please make sure you have the correct access rights
and the repository exists.

运行以下命令检查ssh是否能够连接成功

ssh -T git@github.com

报错:

$ ssh -vT git@github.com
OpenSSH_9.2p1, OpenSSL 1.1.1t  7 Feb 2023
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Connecting to github.com [20.205.243.166] port 22.
debug1: connect to address 20.205.243.166 port 22: Connection timed out
ssh: connect to host github.com port 22: Connection timed out

这个错误消息表明计算机无法通过 SSH 连接到 GitHub。 "Connection timed out" 意味着连接超时。

检查一下是否添加了SSH密钥

cat ~/.ssh/id_rsa.pub

输出显示已经配置密钥了。

查阅资料后,解决问题方案如下:

在 C:\Users\Username\.ssh 目录下&#x

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值