ssh: connect to host github.com port 22: Connection timed out。能访问github且配置了ssh密钥,但是使用git ssh访问不了

ssh: connect to host github.com port 22: Connection timed out

问题描述

有代理能访问到github,也在github上配置了ssh的密钥。但是使用git ssh访问不了。

git clone git@github.com:xxx.git

解决步骤

修改文件 ~/.ssh/config (window: C:\Users\Lenovo.ssh\config )

我添加了以下内容

Host github.com
User <Your email>
Hostname ssh.github.com
PreferredAuthentications publickey
IdentityFile ~/.ssh/id_rsa
Port 443

然后,执行命令ssh -T git@github.com确认问题是否解决,最后在执行之前的命令就能成功运行了。

ssh -T git@github.com
The authenticity of host '[ssh.github.com]:443 ([20.205.243.160]:443)' can't be established.
ED25519 key fingerprint is SHA256:+DiY3wvvV6TuJJhbpZisF/zLDA0zPMSvHdkr4UvCOqU.
This host key is known by the following other names/addresses:
    ~/.ssh/known_hosts:2: github.com
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes

注:过程中需要根据提示输入 yes

根据这个

有时,防火墙完全拒绝允许SSH连接。如果不能使用带凭据缓存的HTTPS克隆,则可以尝试使用通过HTTPS端口建立的SSH连接进行克隆。大多数防火墙规则应该允许这样做,但代理服务器可能会干涉

参考链接:https://stackoverflow.com/questions/15589682/ssh-connect-to-host-github-com-port-22-connection-timed-out

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值