From 7dfa1614226abc8a9de5f20424513a0f2593e612 Mon Sep 17 00:00:00 2001 From: cflmy Date: Mon, 24 Aug 2026 14:56:32 +0800 Subject: [PATCH] Document proxy-7890 push fallback for git network failures Records the working one-shot command (proxy + larger postBuffer) used when direct push fails with curl 35/56 connection resets. Co-authored-by: Cursor --- doc/dev-setup.md | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/doc/dev-setup.md b/doc/dev-setup.md index 3244c1d..813a1b5 100644 --- a/doc/dev-setup.md +++ b/doc/dev-setup.md @@ -68,6 +68,28 @@ proxy = "http://127.0.0.1:7890" --- +## 3.5 Git 推送(遇网络失败时使用代理) + +直连 `git push` 偶尔会报 `RPC failed; curl 35 Recv failure: Connection reset by peer` 或 `curl 56`(远端挂断,常见于数据包稍大时)。此时**通过本机代理 7890 推送**: + +```bash +# Linux/macOS(本机 clash 监听 127.0.0.1:7890) +git -c http.proxy=http://127.0.0.1:7890 -c http.postBuffer=524288000 push origin main +``` + +要点: + +- 代理可用性先探测:`curl -x http://127.0.0.1:7890 -o /dev/null -w "%{http_code}\n" https://github.com`,返回 `200` 再推。 +- `http.postBuffer=524288000`(500 MB)用于规避推送大包被断开(`curl 56`);两个 `-c` 可叠加。 +- 该命令**一次性生效**,不写死仓库配置。若想长期默认走代理,可执行: + ```bash + git config http.proxy http://127.0.0.1:7890 + git config http.postBuffer 524288000 + ``` +- 若是别的代理端口,把 `7890` 换成实际端口(如 Windows 示例里 `$env:HTTPS_PROXY` 的同款端口)。 + +--- + ## 4. 目录约定 | 路径 | 含义 |