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
相关推荐
汤姆yu2 小时前
macOS系统下Aider完整安装、配置与实战使用教程
大数据·人工智能·算法·macos·github·copilot
小弥儿3 小时前
GitHub今日热榜 | 2026-07-04
学习·开源·github
CoderJia程序员甲4 小时前
GitHub 热榜项目 - 周榜(2026-07-04)
ai·大模型·llm·github
REDcker4 小时前
GitHub SSH 连接失败排障实录
运维·ssh·github
菜鸟是大神5 小时前
【Hermes入门11讲】第七讲:定时自动化——让Hermes成为你的24小时助手
人工智能·github·hermes
newbe365247 小时前
我们如何使用 impeccable 优化前端界面设计与实现稳定性
前端·人工智能·分布式·github·aigc·wpf
一次旅行13 小时前
AI 前沿日报 | 2026年7月3日 星期五
人工智能·github·ai编程
青山木18 小时前
快速搭建免费的个人博客网站:Hexo + GitHub Pages + Butterfly 完整指南
git·github
阿里嘎多学长21 小时前
2026-07-03 GitHub 热点项目精选
开发语言·程序员·github·代码托管
江畔柳前堤1 天前
第11章:Docker 安全加固
运维·git·安全·docker·容器·eureka·github