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
相关推荐
miofly7 小时前
Nous Research微调Qwen3.8-27B,宣称可剥离中国官方立场内容
开源·github
用户29914221968013 小时前
GitHub 热榜项目:周榜(2026-11-08)
人工智能·开源·github
用户29914221968013 小时前
GitHub 热榜项目:日榜(2026-11-08)
人工智能·开源·github
miofly16 小时前
GitHub 周榜趋势速报 | 2026-11-08
开源·github
miofly16 小时前
GitHub 日榜趋势速报 | 2026-11-08
开源·github
miofly1 天前
百度开源ERNIE 5.5 Flash Base,总参数280B仅激活14B
开源·github
dong_junshuai1 天前
每天一个开源项目#154 Nushell:结构化管道怎样跨过文本边界
github
Jason_gao9992 天前
Github Copilot 新手极速上手指南
人工智能·github·copilot
GitHub实测笔记2 天前
hexyl 本机实测:8MiB 转储中位 102ms、od 696ms(约 6.8×);默认双面板,NO_COLOR 下要 --color=force
github
MoRay2 天前
放弃云端 Computer Use,我用 Python 手搓了一个带“物理防呆”的本地 GUI Agent 底座
python·github