You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

迁移TFVC至Azure DevOps Git时遇RPC失败(curl 55)错误求助

解决大规模Git历史推送至Azure DevOps时的连接重置问题

问题场景

将包含近25000次提交、40万个对象的TFVC迁移仓库推送到Azure DevOps Git时,触发连接重置错误,具体报错:

Error: RPC failed; curl 55 Recv failure: Connection was reset
send-pack: unexpected disconnect while reading sideband packet
the remote end hung up unexpectedly

推送过程完整输出:

Opening repositories:
C:\oPen2
Pushing master
Enumerating objects: 112075
Enumerating objects: 175757
Enumerating objects: 238207
Enumerating objects: 300062
Enumerating objects: 367176
Enumerating objects: 398928, done.
Delta compression using up to 22 threads
Error: RPC failed; curl 55 Recv failure: Connection was reset
send-pack: unexpected disconnect while reading sideband packet
Total 398928 (delta 333753), reused 398926 (delta 333753), pack-reused 0 (from 0)
Error encountered while pushing to the remote repository: Git failed with a fatal error.
the remote end hung up unexpectedly
Everything up-to-date

解决方案

1. 调整Git HTTP传输配置

默认的HTTP缓存和超时设置不足以支撑大仓库推送,执行以下命令修改:

# 把HTTP POST缓冲区调至5GB
git config --global http.postBuffer 5242880000
# 增大HTTP最大请求长度
git config --global http.maxRequestBuffer 100M
# 取消低速限制并延长超时时间
git config --global http.lowSpeedLimit 0
git config --global http.lowSpeedTime 900

2. 分批次推送历史提交

一次性推送全部历史容易触发超时,按提交时间分段推送:

  • 先找早期提交的哈希值,推送前10000次提交:
    git push origin <早期提交哈希>:master
    
  • 后续每次推送5000次左右的批次,直到所有提交推完。

3. 启用Git打包优化

调整打包参数减少网络拥塞:

# 开启增量打包
git config --global pack.incremental true
# 降低打包线程数,避免占用过多网络资源
git config --global pack.threads 4

4. 切换SSH协议推送

HTTPS协议容易因大流量触发重置,改用SSH协议:

# 替换远程仓库地址为SSH格式
git remote set-url origin git@ssh.dev.azure.com:v3/<组织名>/<项目名>/<仓库名>

5. 清理仓库冗余对象(可选)

如果仓库存在大文件或冗余对象,先清理再推送:

# 排查仓库内的大文件
git rev-list --objects --all | grep "$(git verify-pack -v .git/objects/pack/*.idx | sort -k 3 -n | tail -10 | awk '{print$1}')"
# 用git-filter-repo移除大文件(需提前安装该工具)
git filter-repo --path <大文件路径> --invert-paths

内容的提问来源于stack exchange,提问作者Alex Causer

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.12 08:12:36