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
相关推荐
go54631584657 小时前
本地部署 GitHub 上的 Python 人脸识别项目
开发语言·python·github
程序视点1 天前
惊喜升级!Claude 3.7 Sonnet 上线 GitHub Copilot!已全账号开放!
github·claude·github copilot
今晚打老虎z1 天前
MailKit: 在 .NET 中实现高效电子邮件发送与接收
git·github·.net
架构文摘JGWZ1 天前
5个GitHub热点开源项目!!
学习·github·工具
液态不合群2 天前
DeepSeek “源神”启动!「GitHub 热点速览」
github
JNU freshman2 天前
github 推送的常见问题以及解决
git·github
cjchsh2 天前
ctfhub-web信息泄露通关攻略
windows·python·github
五行缺觉3282 天前
ROS ur10机械臂添加140夹爪全流程记录
c++·经验分享·机器人·github·ur机械臂·moveit!
無炆_2 天前
IDEA-插件开发踩坑记录-第五坑-没有飞机场导致无法访问GITHUB导致的讨厌问题
java·github·intellij-idea
cccccchd2 天前
github如何创建空文件夹
github