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
相关推荐
week_泽3 小时前
github_upload,上传项目
大数据·elasticsearch·github
Code Talk5 小时前
VS Code markdown preview 与 github markdown渲染数学公式中的“_”不一致的问题
github·markdown·math
Hash the Hacker6 小时前
Anonymous Github, 30s 创建匿名repo供盲审使用
github
方也_arkling6 小时前
【Docker】Docker的安装和使用
docker·容器·github
CoderJia程序员甲6 小时前
GitHub 热榜项目 - 日榜(2026-1-1)
ai·开源·大模型·github·ai教程
2501_9462429315 小时前
MPV-EASY Player (MPV播放器) v0.41.0.1
数据库·经验分享·云计算·计算机外设·github·电脑·csdn开发云
CoderJia程序员甲16 小时前
GitHub 热榜项目 - 日榜(2025-12-30)
git·ai·开源·llm·github
夜流冰18 小时前
Git - github-git-cheat-sheet
git·github
阿里嘎多学长19 小时前
2025-12-30 GitHub 热点项目精选
开发语言·程序员·github·代码托管
AutoMQ20 小时前
[特殊字符] 庆祝 AutoMQ 在 GitHub 上突破 9k Stars!
github