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

用git 拉取代码时, 偶尔会出现下面的错误:

bash 复制代码
ssh: connect to host github.com port 22: Connection timed out
fatal: Could not read from remote repository.

出现这个错误的原因是 22 端口被防火墙屏蔽了, 换一个端口即可,如443端口。

操作方法:

bash 复制代码
 vim ~/.ssh/config

添加如下内容:

bash 复制代码
Host github.com
  Hostname ssh.github.com
  Port 443

参考链接: https://zhuanlan.zhihu.com/p/521340971

相关推荐
Yingyingyingyyy3 小时前
GitHub 开源热榜项目-周榜(2026-11-09)
开源·github
孟郎郎15 小时前
打造一切(Craft Anything)——克隆构造世间万物
人工智能·ai·github·软件构建·开源软件
海洋之恒16 小时前
GitHub Actions 自动化:5 个真实运维提效案例
运维·自动化·github
小Z先生16 小时前
我用 Go + 系统 WebView 写了个纯本地 Postman:不装 Electron、不连云端
后端·github
modelmd21 小时前
离线安装与使用 vscode Remote SSH插件
ide·vscode·ssh
瑞克-桑切斯1 天前
docker Harbor 单机部署手册
大数据·运维·elasticsearch·docker·容器
fthux1 天前
待办清单写满了,别忘了给休息留个位置:试试 Tick Rest
开源·github·mac·提醒·open source·消息提醒·tick rest·tick rest for mac·消息提醒app
GitHub实测笔记1 天前
dust 本机实测:/usr 扫树中位 92ms、du -sh 80ms;-s 不是汇总,稀疏文件 0→100Mi
github
逛逛GitHub1 天前
有个刚开源的 GitHub 项目有说法,竟然能在终端里再跑一台 Mac。
github
用户2991422196801 天前
GitHub 热榜项目:日榜(2026-11-09)
人工智能·开源·github