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
相关推荐
rainboy2 小时前
Flutter :自己动手,封装一个小巧精致的气泡弹窗库
前端·flutter·github
Ace_31750887763 小时前
拼多多商品详情接口深度解析:从加密参数破解到数据全量获取
前端·数据库·github
CLTHREE5 小时前
GitHub项目协作完整指南:从Fork到本地开发
github
小鱼小鱼.oO5 小时前
GitHub Actions 和 GitLab CI/CD
ci/cd·gitlab·github
AWS官方合作商6 小时前
告别漫长等待:利用 Amazon GameLift Servers 实现分钟级快速迭代
前端·git·云计算·github·aws
正经教主6 小时前
【Git】Git05-02:Github 基础同步命令
git·github
蝎子莱莱爱打怪7 小时前
MinIO的安装记录
java·后端·github
陈陈陈建蕾7 小时前
Mac使用FFmpeg进行屏幕录制,并使用VLC本地播放
ffmpeg·github
逛逛GitHub7 小时前
清华联合开源!首个基于 MCP 的 RAG 框架,太秀了。
github
阿凤2112 小时前
如何访问GitHub?
github