Git LFS推送报RPC失败错误:TFVC迁移至Git遇HTTP 503问题
TFVC迁移Git后推送遭遇HTTP 503错误的解决思路
问题场景
我正在迁移一个包含4个月历史的大型TFVC仓库到Git,操作流程如下:
- 用
git tfs clone将TFVC目标分支克隆到本地 - 执行
git remote add origin '<空Git仓库URL>'关联新建的远程空仓库 - 启用Git LFS并配置大文件跟踪规则
- 提交本地变更
- 执行
git lfs migrate import --include="*.*" --include-ref=refs/heads/master完成LFS对象转换,随后用git reflog expire --expire-unreachable=now --all和git gc --prune=now清理本地仓库 - 执行
git push origin -u --all推送时触发以下错误:
error: RPC failed; HTTP 503 curl 22 The requested URL returned error: 503 send-pack: unexpected disconnect while reading sideband packet fatal: the remote end hung up unexpectedly Everything up-to-date ##[error]PowerShell exited with code '1'. Finishing: Migrate whole source code to git (git push)
排查与解决方案
优先确认远程Git服务状态
HTTP 503是服务不可用错误,先检查你的远程Git服务(不管是GitHub/GitLab还是自建服务)是否处于维护、限流或宕机状态。如果是企业自建服务,联系管理员排查服务运行状态。拆分推送批次,降低单次数据量
大型仓库首次推送数据量可能超出服务端阈值,尝试以下操作:
- 启用最高压缩:
git config --global core.compression 9 - 分批次推送历史:先用
git push origin master~50:master推送最近50次提交,完成后逐步扩大范围推送更早的历史(根据仓库大小调整数字) - 增大HTTP推送缓冲区:
git config --global http.postBuffer 524288000(设置为500MB,可按需调整)
- 单独推送LFS对象
先推送LFS对象再推送分支,避免混合推送触发流量限制:
git lfs push origin master git push origin -u --all
- 重新清理本地仓库
确保本地没有残留的未转换大文件对象:
git reflog expire --expire=now --all git gc --prune=now --aggressive
- 检查网络环境
确认本地网络到远程Git服务的连接稳定,没有代理、防火墙拦截。如果是企业内网,检查是否需要配置合法代理,或切换到更稳定的网络重试。
内容的提问来源于stack exchange,提问作者Santoshkumar
相关产品推荐
相关产品推荐

