硬汉嵌入式论坛

 找回密码
 立即注册
查看: 424|回复: 3
收起左侧

[其它] 我最近突然github上clone不了了。

[复制链接]

104

主题

585

回帖

912

积分

金牌会员

积分
912
QQ
发表于 2025-9-9 09:36:29 | 显示全部楼层 |阅读模式
本帖最后由 会飞的猪_2020 于 2025-9-9 09:38 编辑

如题,之前挂梯子上的好好的。现在情况是能够正常打开github的网页,但是无法clone也无法push。
昨天发现的这个情况,根据网络上的经验,尝试了好多方法都没解决。



下面是我尝试了还是无效的方法汇总:


1.修改git的proxy
改完后输入这个命令验证
[C] 纯文本查看 复制代码
git config --global -l

可以看到
[C] 纯文本查看 复制代码
http.proxy=socks5://127.0.0.1:7890
https.proxy=socks5://127.0.0.1:7890

这个时候尝试克隆,用https链接克隆成功,但是用ssh克隆失败
[C] 纯文本查看 复制代码
PS C:> git clone [url=https://github.com/FlyyingPiggy2020/clang-format.git]https://github.com/FlyyingPiggy2020/clang-format.git[/url]
Cloning into 'clang-format'...
remote: Enumerating objects: 15, done.
remote: Counting objects: 100% (15/15), done.
remote: Compressing objects: 100% (11/11), done.
remote: Total 15 (delta 5), reused 11 (delta 4), pack-reused 0 (from 0)
Receiving objects: 100% (15/15), 1.16 MiB | 2.82 MiB/s, done.
Resolving deltas: 100% (5/5), done.
PS C:> git clone [url=mailto:git@github.com]git@github.com[/url]:FlyyingPiggy2020/clang-format.git
Cloning into 'clang-format'...
ssh: connect to host github.com port 22: Connection timed out
fatal: Could not read from remote repository.      

Please make sure you have the correct access rights
and the repository exists.



2.修改端口
在config文件中编辑端口,将端口号改为433,依然无法连接
并且ssh -vT git@github.com 不行,但是 ssh -vT git@gitee.com 可以。
说明不是22端口号被防火墙屏蔽
[C] 纯文本查看 复制代码
PS C:> ssh -vT [url=mailto:git@github.com]git@github.com[/url]
OpenSSH_for_Windows_9.5p1, LibreSSL 3.8.2
debug1: Reading configuration data C:\\Users\\moorgen-holfman/.ssh/config
debug1: C:\\Users\\test/.ssh/config line 15: Applying options for github.com
debug1: Connecting to github.com [20.205.243.166] port 22.
PS C:> ssh -vT [url=mailto:git@github.com]git@github.com[/url]
OpenSSH_for_Windows_9.5p1, LibreSSL 3.8.2
debug1: Reading configuration data C:\\Users\\test/.ssh/config
debug1: C:\\Users\\test/.ssh/config line 15: Applying options for github.com
debug1: Connecting to github.com [20.205.243.166] port 433.
debug1: connect to address 20.205.243.166 port 433: Connection timed out
ssh: connect to host github.com port 433: Connection timed out


回复

使用道具 举报

104

主题

585

回帖

912

积分

金牌会员

积分
912
QQ
 楼主| 发表于 2025-9-9 09:58:31 | 显示全部楼层
然后我回家之后,用家里的电脑,发现这样(之前挂梯子上的好好的。现在情况是能够正常打开github的网页,但是无法clone也无法push)
公司里的两台电脑也是这样子,一台笔记本昨天下午刚重装,重装之后想下东西,这才发现的。。

我一开始以为是笔记本问题,后来发现公司电脑也这样,以为是网络出问题了。。
然后回家之后发现家里也这样。。就不知道为啥了。。。
回复

使用道具 举报

104

主题

585

回帖

912

积分

金牌会员

积分
912
QQ
 楼主| 发表于 2025-9-9 10:10:48 | 显示全部楼层
本帖最后由 会飞的猪_2020 于 2025-9-9 10:15 编辑

解决了..


在Google查看别人出现同样问题的评论区:
Port 443 on which host? It should only work on ssh.github.com.

他们说port 433只能被应用于 ssh.github.com.


我之前修改端口号的时候,是在github.com这个host name上面改的。
经过提醒之后测试了如下的命令,可以ssh校验通过了:

ssh -T git@ssh.github.com -p 443
Hi FlyyingPiggy2020! You've successfully authenticated, but GitHub does not provide shell access.


然后克隆命令修改为:
git clone git@ssh.github.com:FlyyingPiggy2020/clang-format.git
Cloning into 'clang-format'...
remote: Enumerating objects: 15, done.
remote: Counting objects: 100% (15/15), done.
remote: Compressing objects: 100% (11/11), done.
remote: Total 15 (delta 5), reused 11 (delta 4), pack-reused 0 (from 0)
Receiving objects: 100% (15/15), 1.16 MiB | 1.28 MiB/s, done.
Resolving deltas: 100% (5/5), done.


最后config文件如下:
[C] 纯文本查看 复制代码
Host ssh.github.com
  User git
  Port 443
  Hostname ssh.github.com
  IdentityFile "C:\Users\test\.ssh\id_rsa"
  TCPKeepAlive yes
回复

使用道具 举报

1万

主题

7万

回帖

11万

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
118335
QQ
发表于 2025-9-9 11:06:10 | 显示全部楼层
谢谢分享。
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|小黑屋|Archiver|手机版|硬汉嵌入式论坛

GMT+8, 2025-9-26 19:42 , Processed in 0.093553 second(s), 25 queries .

Powered by Discuz! X3.4 Licensed

Copyright © 2001-2023, Tencent Cloud.

快速回复 返回顶部 返回列表