github.com port 22: Connection timed out

背景

  • 今天突然用ssh方式 pull GitHub的项目报github.com port 22: Connection timed out
 $ git clone git@github.com:1030907690/dayAndNightAndroidCustomServerPy.git
Cloning into 'dayAndNightAndroidCustomServerPy'...
ssh: connect to host github.com port 22: Connection timed out
fatal: Could not read from remote repository.

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

在这里插入图片描述

  • 这个大概是公司网络把访问出去22端口给屏蔽了,我telnet也不通。

解决方案

  • GitHub允许使用443端口,下面改成走443端口。
  • 先检查走443端口能否行得通。
ssh -T -p 443 git@ssh.github.com
  • 确认有successful提示,如下。
 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 key is not known by any other names
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
Warning: Permanently added '[ssh.github.com]:443' (ED25519) to the list of known hosts.
Hi 1030907690! You've successfully authenticated, but GitHub does not provide shell access.

在这里插入图片描述

  • 确认可以,下一步编辑文件
vim ~/.ssh/config
  • 加入以下代码
Host github.com
Hostname ssh.github.com
Port 443
  • 测试是否成功ssh -T git@github.com,如下所示
    在这里插入图片描述

  • 然后拉取项目就可以了,如下所示
    在这里插入图片描述

参考

posted on   愤怒的苹果ext  阅读(353)  评论(0编辑  收藏  举报

相关博文:
阅读排行:
· 分享一个免费、快速、无限量使用的满血 DeepSeek R1 模型,支持深度思考和联网搜索!
· 基于 Docker 搭建 FRP 内网穿透开源项目(很简单哒)
· ollama系列01:轻松3步本地部署deepseek,普通电脑可用
· 按钮权限的设计及实现
· 25岁的心里话

导航

< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5
点击右上角即可分享
微信分享提示