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

相关推荐
祎直向前14 分钟前
在Ubuntu中安装并配置ssh
linux·ubuntu·ssh
Elasticsearch8 小时前
在 Kibana 中引入 Elasticsearch 查询规则界面
elasticsearch
Elastic 中国社区官方博客8 小时前
使用 Mastra 和 Elasticsearch 构建具有语义回忆功能的知识 agent
大数据·数据库·人工智能·elasticsearch·搜索引擎·ai·全文检索
新手小白*8 小时前
Elasticsearch+Logstash+Filebeat+Kibana部署【7.1.1版本】
大数据·elasticsearch·搜索引擎
lkbhua莱克瓦2411 小时前
Java基础——常用算法4
java·数据结构·笔记·算法·github·排序算法·快速排序
lpfasd12318 小时前
git-团队协作基础
chrome·git·elasticsearch
John Song20 小时前
git多个账号管理
git·github
破烂pan1 天前
github精选Agent学习repo
llm·github·agent
XU磊2601 天前
Git 实现github仓库管理-删除指定目录下的所有文件并保留目录结构
git·github
苗壮.1 天前
「个人 Gitee 仓库」与「企业 Gitee 仓库」同步的几种常见方式
大数据·elasticsearch·gitee