github 端口22 超时问题解决

github 端口22 超时问题解决

问题描述

搬了个公司后发现自己的sourcetree 以及 本地命令行在拉取代码或者clone时均报错,根据网友的解决方案,做了个整理

报错信息

复制代码
$ git pull project develop
ssh: connect to host github.com port 22: Connection timed out
fatal: Could not read from remote repository.

解决方案

使用 ssh 443端口

步骤1

测试端口443是否可用 注意必须存在一个 ssh (如无 请使用命令ssh-keygen -t ed25519 -C "your_email@example.com" 生成,并在github ssh设置中添加),以用于测试

在git命令行中敲入

复制代码
ssh -T -p 443 git@ssh.github.com

步骤2

编辑.ssh 下的config文件,如无直接创建即可

复制代码
Host github.com
Hostname ssh.github.com
Port 443

多ssh的配置config例子如下

复制代码
Host github.com
  Hostname ssh.github.com
  Port 443

Host github.com
  HostName ssh.github.com
  Port 443
  IdentityFile C:\Users\Administrator\.ssh\id_ed25519
  PreferredAuthentications publickey

Host github.com
  HostName ssh.github.com
  Port 443
  IdentityFile C:\Users\Administrator\.ssh\id_peter
  PreferredAuthentications publickey

步骤3

不指定端口进行测试,此时你可以通过SourceTree等进行正常访问

复制代码
ssh -T git@github.com
相关推荐
wflynn4 小时前
GitHub 日榜趋势速报 | 2026-10-10
开源·github
fthux5 小时前
开源小工具 Who Arrives:看看你的公网 IP、地区、时区和网络
http·开源·github
来自于狂人5 小时前
GitHub 开源趋势日报 | 2026年10月10日,告别 Mermaid 的图表设计系统
开源·github
u1301305 小时前
GitHub 热榜项目:日榜(2026-10-10)
人工智能·github
Python测试之道7 小时前
GitHub 实战课|Playwright MCP:让 AI 真的会用浏览器
人工智能·github
小陈运维7 小时前
GitHub Actions + Docker + ACR + GHCR 自动化构建与发布
github
miofly8 小时前
AI 智能体用 83% 字节精确匹配反编译完整游戏
开源·github
TunerT_TQ11 小时前
开源评测】openai/math 深度拆解:722 份 AI 数学手稿与 Lean 形式化的工程真相
github
W.A委员会11 小时前
PID自动整定与LLM调优项目使用说明(源码附文末)
自动化·github