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

相关推荐
ShawnLiaoking17 分钟前
Github 克隆 PyCharm,vscode
ide·pycharm·github
Zhu75828 分钟前
【软件更新】在Ubuntu24 LTS中更新openssl到指定版本,例如openssl3.5.6 LTS
linux·ssh·ssl
有理想的打工人1 小时前
gitlab群组管理与ssh链接
ssh·gitlab
勇哥的编程江湖1 小时前
flinkcdc streaming 同步数据到es记录过程
大数据·elasticsearch·flink·flinkcdc
曾阿伦1 小时前
Elasticsearch 7.x 常用命令备忘录
大数据·elasticsearch·搜索引擎
想七想八不如114081 小时前
【GitHub开源】一款基于 Python 的人脸识别 C/S 系统:YOLOv5 + PyQt5 + 批量入库
yolo·开源·github
CoderJia程序员甲1 小时前
GitHub 热榜项目 - 日榜(2026-04-10)
人工智能·ai·大模型·github·ai教程
斯特凡今天也很帅2 小时前
Elasticsearch数据库专栏(二)DSL语句总结(更新中)
大数据·elasticsearch·搜索引擎
辣椒酱.2 小时前
github入门与实战
github
要记得喝水2 小时前
适用于 Git Bash 的脚本,批量提交和推送多个仓库的修改
git·elasticsearch·bash