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
相关推荐
Zzz 小生11 小时前
LangChain Streaming-Overview:流式处理使用完全指南
人工智能·python·语言模型·langchain·github
用户5798547697118 小时前
04:工具系统设计:从抽象基类到 JSON Schema 的完整实现
github
fchampion19 小时前
最终一致性
java·spring·rabbitmq·github·mvc
猫头虎20 小时前
OpenClaw 常用操作命令完整速查手册:终端 CLI 操作指令详解|聊天斜杠指令详情
运维·git·容器·开源·github·aigc·ai编程
阿里嘎多学长2 天前
2026-02-20 GitHub 热点项目精选
开发语言·程序员·github·代码托管
迈克桀森2 天前
Git 日常操作全攻略:拉取 / 提交代码 + 高频命令速查
git·github
xuhe22 天前
掌控Coding Plan刷新节奏, 低价套餐满足高峰时期编程需求 -- Quota-Activator
ai·github
Mintimate2 天前
LeanCloud 遗憾谢幕:基于 EdgeOne KV 打造高性能 PV/UV 访客统计
serverless·github·边缘计算
犽戾武2 天前
Ubuntu(Orange Pi / RK3588)把工程上传到 GitHub 的完整流程总结(Windows差不多)
github
CoderJia程序员甲2 天前
GitHub 热榜项目 - 日榜(2026-02-18)
人工智能·ai·大模型·github·ai教程