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

相关推荐
Dragon~Snow1 小时前
Linux Centos9 安装 Elasticsearch
linux·elasticsearch·jenkins
熊延1 小时前
麒麟V10系统安装部署elasticsearch
linux·运维·服务器·elasticsearch·搜索引擎·全文检索
玄同7652 小时前
Git常用命令指南
大数据·git·elasticsearch·gitee·github·团队开发·远程工作
野指针YZZ3 小时前
一键配置RK3588网络与SSH远程连接
网络·ssh·rk3588
吠品3 小时前
命令行揭示SSL证书真相
https·github·ssl
、BeYourself3 小时前
解决git@github.com: Permission denied (publickey)
github
Elasticsearch4 小时前
弥合差距:从云原生到大型机的端到端可观测性
elasticsearch
十步杀一人_千里不留行5 小时前
Git提交前ESLint校验实践(Husky + lint-staged)
git·github
朱昆鹏6 小时前
开源 Claude Code + Codex + 面板 的未来vibecoding平台
前端·后端·github
java-yi7 小时前
Elasticsearch(ES)核心用法与实战技巧分享
大数据·elasticsearch·搜索引擎