解决 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

相关推荐
Elastic 中国社区官方博客8 分钟前
Elasticsearch 如何通过 synthetic _id 和 Bloom filters 将时序存储降低 34%
大数据·数据库·elasticsearch·搜索引擎·serverless·全文检索·时序数据库
AIMath~17 分钟前
向github中上传文件过大超过50M怎么办
网络·git·github
麷飞花23 分钟前
Github开源协议
github·开源协议
用户8876654266339 分钟前
Git 和 GitHub 入门:从版本控制到团队协作,一篇文章讲清楚
面试·github
pipo1 小时前
从“开机全靠猜”到任意位置重定位:我做了一个 ROS 2 3D LiDAR 导航系统
github
Cosolar2 小时前
QwenPaw 源码学习指南
人工智能·架构·github
AskHarries2 小时前
OpenClaw Skill 从哪里找
大数据·elasticsearch·搜索引擎
沉默王二3 小时前
每月13亿免费Token,14家AI大厂的API任你用,包括Gemini
github·claude·gemini
AIMath~4 小时前
如何将一个新的文件夹使用git 工具提交到github新仓库中
git·github
Yunzenn5 小时前
深度分析字节最新研究cola-DLM 第 10 章:从文本到多模态 —— 统一生成的未来
github