Why does git push fail?; "error: RPC failed; curl 18 transfer closed with outstanding read data remaining"; "send-pack: unexpected disconnect whil

Why does git push fail?; "error: RPC failed; curl 18 transfer closed with outstanding read data remaining"; "send-pack: unexpected disconnect whil

我一直在尝试 git push 一些文件到我刚刚创建的 repo 中,但总是失败。

我已经尝试将 http.version 从 HTTP/2 更改为 HTTP/1.1(我都试过了)并且我还增加了 http.postBufferhttp.maxRequestBuffer 尺寸。我在网上找到的大多数修复建议更改其中一项或两项。

我本地工作目录中的最大文件是 24.6 MB(不包括 .pack 文件)所以我不必使用 Git LFS。

这是 git config --list 的一些输出:

diff.astextplain.textconv=astextplain
filter.lfs.clean=git-lfs clean -- %f
filter.lfs.smudge=git-lfs smudge -- %f
filter.lfs.process=git-lfs filter-process
filter.lfs.required=true
http.sslbackend=openssl
http.sslcainfo=C:/Program Files/Git/mingw64/ssl/certs/ca-bundle.crt
core.autocrlf=true
core.fscache=true
core.symlinks=false
pull.rebase=false
credential.helper=manager-core
credential.https://dev.azure.com.usehttppath=true
init.defaultbranch=master
core.editor="C:\Users\username\AppData\Local\Programs\Microsoft VS Code\Code.exe"
--wait
core.longpaths=true
core.compression=0
gui.recentrepo=C:/Users/username/path/to/myRepo
filter.lfs.clean=git-lfs clean -- %f
filter.lfs.smudge=git-lfs smudge -- %f
filter.lfs.process=git-lfs filter-process
filter.lfs.required=true
...
http.postbuffer=30000000
http.version=HTTP/1.1
http.maxrequestbuffer=300000000
credential.helper=wincred
core.bare=false
core.repositoryformatversion=0
core.filemode=false
core.symlinks=false
core.ignorecase=true
core.logallrefupdates=true
remote.origin.url=https://github.com/username/myRepo.git
remote.origin.fetch=+refs/heads/*:refs/remotes/origin/*
remote.origin.pushurl=https://github.com/username/myRepo.git
branch.main.remote=origin
branch.main.merge=refs/heads/main

这是 git push 之后的输出:

Enumerating objects: 177, done.
Counting objects: 100% (177/177), done.
Delta compression using up to 8 threads
Compressing objects: 100% (168/168), done.
error: RPC failed; curl 18 transfer closed with outstanding read data remaining
send-pack: unexpected disconnect while reading sideband packet
Writing objects: 100% (177/177), 444.10 MiB | 612.00 KiB/s, done.
Total 177 (delta 5), reused 177 (delta 5), pack-reused 0
fatal: the remote end hung up unexpectedly
Everything up-to-date

除了 Windows Defender,我没有使用 antivirus/firewall。

请帮忙。

在我的情况下,我试图 push 负载过大。根据 this article,“因为 github 不允许单次推送大于 2GB 你可以分批推送。将推送分成 part1,part2…”

我的解决方案是将有效负载分解为多个提交并一次推送两个。根据您的情况,如果您的存储库中有提交历史记录,您可以尝试将 shell 脚本编写到 push 并逐渐增加到 HEAD。我最终并没有这样做,而是充分利用了多行 git add 命令的匹配模式 select 每个 push.

我想要的文件