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
相关推荐
NocoBase1 天前
【2.0 教程】第 1 章:认识 NocoBase ,5 分钟跑起来
数据库·人工智能·开源·github·无代码
量子位1 天前
字节版龙虾架构火爆GitHub!开源获35k+ Star,内置Skill全家桶,原生适配飞书
github·ai编程
汪海游龙2 天前
开源项目 Trending AI 招募 Google Play 内测人员(12 名)
android·github
HealthScience2 天前
github怎么授权ssh(私人库授权)
运维·ssh·github
CoderJia程序员甲2 天前
GitHub 热榜项目 - 日榜(2026-03-22)
人工智能·ai·大模型·github·ai教程
阿里嘎多学长2 天前
2026-03-22 GitHub 热点项目精选
开发语言·程序员·github·代码托管
研究点啥好呢2 天前
3月22日GitHub热门项目推荐|网页浏览,何须手动
人工智能·python·开源·github
darkb1rd2 天前
ClawTeam:让 AI 代理组成集群,实现全自动化工作流
开源·github·好物分享
scilwb2 天前
《TIAGo Dual 机器人 Isaac Sim (PhysX Lidar) + Cartographer 2D SLAM 严谨配置全流程指南》
github