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

相关推荐
打妖妖灵滴哪吒6 小时前
github创建远程仓库+推送代码(图文版)
github
笨鸟先飞,勤能补拙6 小时前
AI 赋能网络安全:技术全景、成熟度评估与实战案例
人工智能·python·安全·web安全·网络安全·sqlite·github
笨鸟先飞,勤能补拙9 小时前
AI 赋能网络安全领域深度剖析
网络·人工智能·windows·安全·web安全·网络安全·github
gwf21612 小时前
SSD读写速度深度解析:顺序读写vs随机读写、IOPS、延迟,你的硬盘性能到底怎么看?
git·嵌入式硬件·缓存·github·智能硬件
西邮彭于晏12 小时前
图文详解:Git分支创建、合并与冲突解决|新手零门槛完整教程
大数据·git·elasticsearch
Elastic 中国社区官方博客15 小时前
Elastic 和 OpenAI 合作,将前沿智能引入非结构化企业数据
大数据·数据库·人工智能·elasticsearch·搜索引擎·ai
Elastic 中国社区官方博客16 小时前
Elasticsearch:搜索教程 - 全文搜索(一)
大数据·python·elasticsearch·搜索引擎·全文检索
西邮彭于晏17 小时前
Git 标签(Tag)与版本发布完整指南|附全场景命令速查表
大数据·git·elasticsearch
笨鸟先飞,勤能补拙17 小时前
下一个十年:网络安全正在被重写
网络·人工智能·安全·web安全·网络安全·github
Elasticsearch18 小时前
Elasticsearch:搜索教程 - 语义搜索(三)
elasticsearch