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
相关推荐
993166619 分钟前
一个人用 AI 的困局:它从不反对你,所以我让 5 个 AI 开了场圆桌会议
github·deepseek
其实防守也摸鱼2 小时前
每天一个知识点——RCE漏洞
运维·服务器·数据库·windows·安全·github·漏洞
u1301303 小时前
GitHub 热榜项目:日榜(2026-09-12)
github
TunerT_TQ3 小时前
Netflix|一个时代的终结:Hystrix静态工程评测,兼谈微服务容错范式的代际迁移
开源·github·资讯
m4Rk_3 小时前
【论文阅读】Agent 记忆机制(68):Memp——把历史轨迹沉淀为可检索、可纠错的程序性记忆
论文阅读·人工智能·学习·开源·github
峰向AI5 小时前
腾讯开源的AI管理的瑞士军刀:让团队经验自动传承
github
Howie_05267 小时前
AI-test-agent(一)刚入门测试也能读懂:一个基于 LangGraph + Playwright 的开源测试工作台
github
zhurui_xiaozhuzaizai7 小时前
github上关于节省token的项目一览,上下文压缩,节省token,agent优化skill,热门项目
人工智能·深度学习·github
旧梦星轨7 小时前
Git Flow 工作流实践
git·gitee·gitlab·github
QUOR7 小时前
ZorvAI · GenUI 技术构架与功能介绍
html·github