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
相关推荐
油泼辣子多加40 分钟前
2025年08月21日Github流行趋势
github
uhakadotcom2 小时前
最近rust生态有啥能力更新?
后端·面试·github
AxonoSensei4 小时前
4 利用annaconda进行环境搭建
github
在狂风暴雨中奔跑6 小时前
免费打造你的个人网页——GitHub Pages使用指南
github
小华同学ai6 小时前
Github 2.3k star 太牛x,京东(JoyAgent‑JDGenie)这个开源项目来得太及时啦,端到端多智能体神器!!!
前端·后端·github
dream_home84076 小时前
github 上传代码步骤
github
小华同学ai7 小时前
炸裂!Github 6000+ star 开源免费易用,支持1000+格式转换,值得收藏!
前端·后端·github
handsomestWei17 小时前
github jekyll博客SEO搜索引擎优化
搜索引擎·github·seo·jekyll
叔叔别拉了我害怕1 天前
封装FTPSClient连接ftps服务器
服务器·git·github
CoderJia程序员甲1 天前
GitHub 热榜项目 - 日榜(2025-08-21)
ai·开源·github·ai编程