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 "[email protected]" 生成,并在github ssh设置中添加),以用于测试

在git命令行中敲入

复制代码
ssh -T -p 443 [email protected]

步骤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 [email protected]
相关推荐
m0_635647484 小时前
git管理github上的repository(二)
git·github
qianmoQ6 小时前
GitHub 趋势日报 (2025年06月08日)
github
Aisanyi9 小时前
【鸿蒙开发从入门到放弃】新建项目,并接入Git
github·harmonyos
阿群的AI工作室13 小时前
新手必看喂饭级教程🔥原来这样用SSH推代码到GitHub才对!
github
中微子14 小时前
📝 终极Git Commit Message规范指南:写出专业级提交记录
git·github
小华同学ai14 小时前
真香,Cursor懂的都懂(学习用哈),22.5k一键重置Cursor试用限制!被全网疯狂收藏!
前端·后端·github
Android洋芋14 小时前
Steam++开发逻辑详解:从零到一的实战指南
后端·github
寻月隐君14 小时前
用 Rust 在 Solana 上打造你的专属代币:从零到一的 Web3 实践
后端·web3·github
梓羽玩Python17 小时前
3B小模型吊打72B巨头!轻量级文档解析OCR,性能超Gemini,高效且精准!
github
梓羽玩Python17 小时前
轻量级语音模型Vui开源,支持本地部署,笑声停顿全拟真,4万小时练出人类对话感!
github