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
,如下所示
-
然后拉取项目就可以了,如下所示
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 分享一个免费、快速、无限量使用的满血 DeepSeek R1 模型,支持深度思考和联网搜索!
· 基于 Docker 搭建 FRP 内网穿透开源项目(很简单哒)
· ollama系列01:轻松3步本地部署deepseek,普通电脑可用
· 按钮权限的设计及实现
· 25岁的心里话