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
相关推荐
小镇学者11 小时前
【python】python项目是如何部署到服务器上的
服务器·python·github
cws20040116 小时前
MFA双因素用户使用手册
运维·windows·网络安全·github·邮件·邮箱
无限进步_20 小时前
二叉搜索树(BST)详解:从原理到实现
开发语言·数据结构·c++·ide·后端·github·visual studio
大强同学21 小时前
CloudFlare-ImgBed+HuggingFace图床搭建教程
windows·github·图床搭建
T_Fire_of_Square1 天前
crewai的进一步工具扩展
python·github
明洞日记1 天前
【软考每日一练015】计算机网络:DNS 递归查询与迭代查询解析
git·计算机网络·github
无限进步_2 天前
【C++】大数相加算法详解:从字符串加法到内存布局的思考
开发语言·c++·windows·git·算法·github·visual studio
烟锁池塘柳02 天前
GitHub 强制回退版本并覆盖远程仓库
git·github
Maggie_ssss_supp2 天前
Linux-MySQL主从复制
github
cg50172 天前
Continue插件实现本地部署一个“cursor”或“github copilot”
github·copilot·curcor