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

相关推荐
天衍四九11 小时前
Git从0到实战(四):冲突解决与版本回退 —— 别怕,出错了也能救
github
大刚测试开发实战11 小时前
如何内网穿透访问本地私有化部署的TestHub
前端·后端·github
uhakadotcom1 天前
在python 的 工程化架构中 ,什么是 薄包装器层?
后端·面试·github
Elasticsearch1 天前
如何通过 Claude Code 来写入 CSV 数据到 Elasticsearch
elasticsearch
Avan_菜菜2 天前
AI 能写代码了,为什么我反而开始要求它先写文档?
前端·github·ai编程
逛逛GitHub2 天前
这个爆红的 GitHub 项目让 token 直接省 60–95%。
github
iccb10132 天前
5年,一个程序员是如何把私有化在线客服系统做到第一名的
前端·后端·github
蝎子莱莱爱打怪2 天前
AI Agent 相关知识扫盲:16 个概念+11张图+38个开源项目推荐
人工智能·github·agent
用户317723070362 天前
Pydub:用 Python 处理音频,不写废话
github
张居邪3 天前
GitHub Actions + 阿里云 OSS:OIDC 免密同步构建产物
后端·github