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
相关推荐
AC使者13 小时前
介绍 TensorFlow 的基本概念和使用场景。
开发语言·自然语言处理·sqlite·github
JustHappy14 小时前
「我们一起做组件库🌻」做个面包屑🥖,Vue的依赖注入实战💉(VersakitUI开发实录)
前端·javascript·github
桃木山人16 小时前
BigData File Viewer报错
大数据·java-ee·github·bigdata
逸Y 仙X20 小时前
Git常见命令--助力开发
java·大数据·git·java-ee·github·idea
007_rbq21 小时前
XUnity.AutoTranslator-Gemini——调用Google的Gemini API, 实现Unity游戏中日文文本的自动翻译
人工智能·python·游戏·机器学习·unity·github·机器翻译
非 白1 天前
【后端】gitHub访问速度太慢解决办法
github
dringlestry1 天前
pycharm将当前项目上传到github
ide·pycharm·github
油泼辣子多加2 天前
2025年02月17日Github流行趋势
github
徐小夕2 天前
H5-Dooring零代码搭建:从开源到商业化的4年蜕变
前端·javascript·github
QQ3596773452 天前
Github开源AI LLM大语言模型WebUI框架推荐
人工智能·开源·github