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
相关推荐
怣疯knight40 分钟前
Github 2FA(Two-Factor Authentication/两因素认证)
github
MilesShi43 分钟前
从零到工程化:用 GitHub Actions 高效集成 Playwright 测试
自动化·github
梦梦代码精4 小时前
从工程视角拆解 BuildingAI:一个企业级开源智能体平台的架构设计与实现
人工智能·gitee·开源·github
zhensherlock10 小时前
Protocol Launcher 系列:Trello 看板管理的协议自动化
前端·javascript·typescript·node.js·自动化·github·js
FEF前端团队15 小时前
开发知识库 #01:Git 全面操作教程
git·github
栩栩云生16 小时前
x-cmd v0.8.15: claw AI 助手升级,连微信、飞书更稳了;free 新增专家模式,直接把底层内存细节喂给你
github·agent·命令行
傻啦嘿哟17 小时前
Python 文件批量处理:重命名/备份/同步运维实战指南
linux·数据库·github
淘矿人17 小时前
Claude辅助算法设计与优化
人工智能·python·算法·microsoft·github·bug·pygame
逛逛GitHub18 小时前
给 10 万 Star 的 Hermes 装个记忆外挂,AI 终于能越用越聪明了。
github
王莎莎-MinerU18 小时前
MinerU 生态全接入:LangChain、Dify、RAGFlow、LlamaIndex 六大框架完整集成指南(2026)
计算机视觉·chatgpt·langchain·pdf·github·aigc