怎么在 push 代码到 github 时用上小飞机?

最近很多朋友都提到 github 很难打开,开了小飞机能访问 github 网站了,但是在 push 代码时又没办法 push 上去。

遇到的报错日志大概是这样的:

vbnet 复制代码
fatal: unable to access 'https://github.com/your-user-name/your-repo.git/': Failed to connect to github.com port 443 after 21057 ms: Timed out

很明显,是网络超时了。并且重试很多次也没有什么起色。

我们心里可能会想,明明我已经科学上网了,为啥 github 还 push 不上去?这是因为 git 默认是不会使用系统网络代理的,即便我们的某猫工具已经被设置为系统网络代理,还是解决不了往 github push 代码的问题。

那么怎么在 push 代码到 github 时用上小飞机呢?

其实只要用到网络请求的,基本上都可以设置代理,git 也不例外。

首先,我们找到代理工具的网络端口,以某猫为例,一般是 7890 端口。

然后,通过 git 提供的配置能力设置 http 和 https 代理。

我们可以先查看一下之前有没有设置过代理,

lua 复制代码
git config --global http.proxy
git config --global https.proxy

如果执行上述命令后没有任何输出,说明没有设置过代理,此时可以执行以下命令:

lua 复制代码
git config --global http.proxy 127.0.0.1:7890
git config --global https.proxy 127.0.0.1:7890

此时再 push 代码到 github 就显得轻而易举了。

相关推荐
DogDaoDao6 小时前
Windows 开发提效工具全景指南:60+ 工具的工程化分层配置
windows·git·程序员·开发工具·powershell·everything·msys2
苏灿烤鱼7 小时前
没有机密文件,也没有付费数据,在浏览器里造一颗"间谍卫星"
前端·javascript·github
粥里有勺糖9 小时前
视野修炼-技术周刊第131期 | Bun 与 pnpm Rust 化
前端·github·agent
旅之灵夫12 小时前
【GitHub项目推荐--HyperFrames:用 HTML 写视频,为 AI Agent 而生的渲染框架】
github
峰向AI13 小时前
阿里内部用了2年的代码审查工具开源了:21k Star背后的「工业级」设计
github
zandy101113 小时前
2026vibe coding背后 :Kimi Code、Cursor、Claude Code、GitHub Copilot等五款工具架构演进全面分析
架构·github·copilot
zandy101114 小时前
网络支付合规三重门:Kimi Code、Cursor、GitHub Copilot等五款AI编程工具国内实战测评
github·copilot·ai编程
ssshooter16 小时前
Tauri + GitHub Actions 自动化发布 Android APK 技术总结
android·github·android studio
wdfk_prog16 小时前
GitHub push 失败:如何扫描并清理 Git 历史中的大文件
git·elasticsearch·github
Da Zeng17 小时前
快速搭建GitHub Page
github