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
相关推荐
zhensherlock10 小时前
Protocol Launcher 系列:CodeHub 移动端 GitHub 协作利器
前端·javascript·typescript·node.js·自动化·github·js
一条Go13 小时前
状态页与 SLA:对外承诺是怎么算出来的
后端·架构·github
一条Go13 小时前
开源新生代雷达 · 第 18 期
github
时早玖沐14 小时前
微信输入法的算式结果时灵时不灵,我用 AutoHotkey 补了个按 = 出答案的
程序员·开源·github
杨凯凡1 天前
IT日报|2026-11-20:欧盟 AI 网络攻击、Valkey 9.2、GitHub 企业迁移
人工智能·github
TunerT_TQ1 天前
Terraform OCI Provider 2026:工具链的骨架清晰可见,CRUD 的肌肉必须由你亲自验证
github
prince_zxill2 天前
把 17 个散文件装进一个文件夹:拆解 claude-plugins-official 的插件打包术(47,413 Star 实测)
python·github·agent·mcp·claude code
wflynn2 天前
GitHub 日榜趋势速报 | 2026-11-20
开源·github
TunerT_TQ2 天前
【开源评测】google-labs-code/stitch-skills:从设计交接到可检查的组件产物
github
一条Go2 天前
探测规则:为什么它是告警规则的一种,而不是独立的任务体系
后端·架构·github