error: RPC failed; HTTP 400 curl 22 The requested URL returned error: 400

1. 报错信息

bash 复制代码
Enumerating objects: 10, done.
Counting objects: 100% (10/10), done.
Delta compression using up to 8 threads
Compressing objects: 100% (8/8), done.
error: RPC failed; HTTP 400 curl 22 The requested URL returned error: 400
send-pack: unexpected disconnect while reading sideband packet
Writing objects: 100% (8/8), 1.18 MiB | 1.11 MiB/s, done.
Total 8 (delta 0), reused 0 (delta 0), pack-reused 0
fatal: the remote end hung

2. 解决

问了Qwen等LLM,没用,还是stackoverflow

根据:

执行以下操作:

bash 复制代码
# 方法1 把要push的内容分多次push,先回退,再分多次提交

# 方法2,临时修改 buffer size,提交完再改回去,防止吃内存
git config http.postBuffer 524288000
git pull && git push
git config --unset http.postBuffer

3. 原因探索

不一定是网络原因,而是 buffer size的问题

bash 复制代码
# 查看日志中关于http传输的信息
> GIT_CURL_VERBOSE=1 GIT_TRACE=1 git push 2>&1 | grep -A 10 "HTTP"
09:17:04.433505 http.c:701              == Info: CONNECT tunnel: HTTP/1.1 negotiated
09:17:04.433509 http.c:701              == Info: allocate connect buffer
 # 分配缓存
09:17:04.433515 http.c:701              == Info: Establish HTTP proxy tunnel to github.com:443
09:17:04.433557 http.c:648              => Send header, 0000000127 bytes (0x0000007f)
09:17:04.433564 http.c:660              => Send header: CONNECT github.com:443 HTTP/1.1
09:17:04.433567 http.c:660              => Send header: Host: github.com:443
09:17:04.433570 http.c:660              => Send header: User-Agent: git/2.39.2 (Apple Git-143)
09:17:04.433573 http.c:660              => Send header: Proxy-Connection: Keep-Alive
09:17:04.433575 http.c:660              => Send header:
09:17:04.433753 http.c:648              <= Recv header, 0000000037 bytes (0x00000025)
09:17:04.433761 http.c:660              <= Recv header: HTTP/1.1 200 Connection established
09:17:04.433775 http.c:648              <= Recv header, 0000000002 bytes (0x00000002)
09:17:04.433778 http.c:660              <= Recv header:
09:17:04.433783 http.c:701              == Info: CONNECT phase completed
09:17:04.433787 http.c:701              == Info: CONNECT tunnel established, response 200
09:17:04.433840 http.c:701              == Info: ALPN: curl offers h2,http/1.1
09:17:04.433996 http.c:701              == Info: (304) (OUT), TLS handshake, Client hello (1):
09:17:04.441583 http.c:701              == Info:  CAfile: /etc/ssl/cert.pem
09:17:04.441600 http.c:701              == Info:  CApath: none
09:17:05.517635 http.c:701              == Info: (304) (IN), TLS handshake, Server hello (2):
09:17:05.517918 http.c:701              == Info: (304) (IN), TLS handshake, Unknown (8):
--
09:17:05.521669 http.c:701              == Info: using HTTP/2
09:17:05.521703 http.c:701              == Info: [HTTP/2] [1] OPENED stream for https://github.com/XXX/XXX.git/info/refs?service=git-receive-pack
09:17:05.521708 http.c:701              == Info: [HTTP/2] [1] [:method: GET]
09:17:05.521710 http.c:701              == Info: [HTTP/2] [1] [:scheme: https]
09:17:05.521713 http.c:701              == Info: [HTTP/2] [1] [:authority: github.com]
09:17:05.521715 http.c:701              == Info: [HTTP/2] [1] [:path: /XXXX/XXXX.git/info/refs?service=git-receive-pack]
09:17:05.521718 http.c:701              == Info: [HTTP/2] [1] [user-agent: git/2.39.2 (Apple Git-143)]
09:17:05.521721 http.c:701              == Info: [HTTP/2] [1] [accept: */*]
09:17:05.521723 http.c:701              == Info: [HTTP/2] [1] [accept-encoding: deflate, gzip]
09:17:05.521726 http.c:701              == Info: [HTTP/2] [1] [pragma: no-cache]  
# 这里显示 no_cache 所以真的是缓存不够了????
09:17:05.521751 http.c:648              => Send header, 0000000198 bytes (0x000000c6)
09:17:05.521756 http.c:660              => Send header: GET /xxx/xxx.git/info/refs?service=git-receive-pack HTTP/2
09:17:05.521759 http.c:660              => Send header: Host: github.com
09:17:05.521761 http.c:660              => Send header: User-Agent: git/2.39.2 (Apple Git-143)
09:17:05.521764 http.c:660              => Send header: Accept: */*
09:17:05.521767 http.c:660              => Send header: Accept-Encoding: deflate, gzip
09:17:05.521769 http.c:660              => Send header: Pragma: no-cache
09:17:05.521771 http.c:660              => Send header:
09:17:05.521781 http.c:701              == Info: Request completely sent off
09:17:05.898901 http.c:648              <= Recv header, 0000000013 bytes (0x0000000d)
09:17:05.898912 http.c:660              <= Recv header: HTTP/2 401
09:17:05.898919 http.c:648              <= Recv header, 0000000026 bytes (0x0000001a)
09:17:05.898922 http.c:660              <= Recv header: server: GitHub-Babel/3.0
09:17:05.898927 http.c:648              <= Recv header, 0000000054 bytes (0x00000036)
09:17:05.898929 http.c:660              <= Recv header: content-security-policy: default-src 'none'; sandbox
09:17:05.898934 http.c:648              <= Recv header, 0000000041 bytes (0x00000029)
09:17:05.898936 http.c:660              <= Recv header: content-type: text/plain; charset=UTF-8
09:17:05.898940 http.c:648              <= Recv header, 0000000040 bytes (0x00000028)
09:17:05.898943 http.c:660              <= Recv header: www-authenticate: Basic realm="GitHub"
09:17:05.898958 http.c:648              <= Recv header, 0000000020 bytes (0x00000014)
09:17:05.898966 http.c:660              <= Recv header: content-length: 21
相关推荐
安静轨迹9 小时前
TLS_SSL 警报码完整手册
网络·网络协议·ssl
F1FJJ15 小时前
Shield CLI PostgreSQL 插件现已上架 VS Code 扩展市场
网络·vscode·网络协议·postgresql·开源软件
jinanwuhuaguo17 小时前
OpenClaw全网使用人群全景深度分析报告
网络·人工智能·网络协议·rpc·openclaw
努力的lpp17 小时前
小迪安全第10天:HTTP数据包分析与构造
网络协议·安全·http
带娃的IT创业者18 小时前
WeClaw_41_桌面端与PWA文件双向传输:WebSocket与HTTP混合协议设计
websocket·网络协议·http·文件传输·pwa
i建模19 小时前
python, conda SSL证书错误修复及conda更新
网络协议·conda·ssl
FPGA小迷弟21 小时前
FPGA工程师面试题汇总(九)
网络协议·tcp/ip·fpga开发·面试·verilog·fpga
白慕慕1 天前
tcp传输
linux·网络协议·tcp/ip
左手厨刀右手茼蒿1 天前
Flutter 组件 http_requests 适配鸿蒙 HarmonyOS 实战:极简网络请求,构建边缘端轻量级 RESTful 通讯架构
网络·flutter·http
晏宁科技YaningAI1 天前
全球短信路由系统设计逻辑打破 80%送达率瓶颈:工程实践拆解
网络·网络协议·架构·gateway·信息与通信·paas