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
相关推荐
chhanz24 分钟前
git/github入门基操(终端版)
git·github
Bacon4 小时前
Electron 应用商店:开箱即用工具集成方案
前端·github
掘金安东尼11 小时前
GPT-6 会带来科学革命?奥特曼最新设想:AI CEO、便宜医疗与全新计算机
前端·vue.js·github
逛逛GitHub12 小时前
国产开源 AI CRM 系统,用它替换了 7 年的 Salesforce。
github
散峰而望12 小时前
C++入门(二) (算法竞赛)
开发语言·c++·算法·github
HelloGitHub13 小时前
让 AI 记住我家狗叫「十六」,原来只需要 5 分钟
开源·github
CoderJia程序员甲14 小时前
GitHub 热榜项目 - 日榜(2025-11-04)
开源·github·ai编程·github热榜
lkbhua莱克瓦241 天前
Java练习-正则表达式 1
java·笔记·正则表达式·github
JanelSirry1 天前
Redis服务器的的内存是多大
服务器·redis·github
稚麟1 天前
GitHub Copilot CLI: How to get started
github·copilot