问题更改git http.postBuffer。

huangapple go评论60阅读模式
英文:

issues with changing git http.postBuffer

问题

我尝试了 git config --global http.postBuffer 157286400,但没有任何反应。我收到了以下错误信息:

error: RPC failed; HTTP 500 curl 22 The requested URL returned error: 500
send-pack: unexpected disconnect while reading sideband packet
Writing objects: 100% (213/213), 8.64 GiB | 9.31 MiB/s, done.
Total 213 (delta 0), reused 0 (delta 0), pack-reused 0
fatal: the remote end hung up unexpectedly
Everything up-to-date
英文:

I tried git config --global http.postBuffer 157286400
but nothing happened. I get this error

error: RPC failed; HTTP 500 curl 22 The requested URL returned error: 500
send-pack: unexpected disconnect while reading sideband packet
Writing objects: 100% (213/213), 8.64 GiB | 9.31 MiB/s, done.
Total 213 (delta 0), reused 0 (delta 0), pack-reused 0
fatal: the remote end hung up unexpectedly
Everything up-to-date

答案1

得分: 1

GitHub不允许超过2 GiB的推送,而您试图推送8.64 GiB。这太大了,您需要将其分成较小的部分进行推送。

如果您的数据完全在一个提交中,那么它太大了,您需要将其拆分为多个提交。

您可以使用类似以下的方法,根据您的情况调整常量(30000、originmain)。

git rev-list --reverse --all --not --remotes=origin | ruby -ne 'x ||=0; x += 1; print $_ if x % 30000 == 0;' | xargs -I{} echo git push origin +{}:refs/heads/temp
git push origin +main :refs/heads/temp

这将逐步将数据推送到名为temp的分支,最后将最终值推送到main,然后删除temp。如果您只有少量提交,那么您可能需要将30000更改为2甚至1。这也可以很容易地使用Perl而不是Ruby来完成,但留给读者作为练习。

请注意,根据Git FAQ,通常不应该使用http.postBuffer。唯一具有功能性好处的情况是,如果GitHub或介于您和GitHub之间的代理服务器不正确地支持HTTP/1.1,不理解分块传输编码。GitHub显然没有这个问题,希望您也没有使用这样的代理(因为很多东西都会出现问题),所以设置它只会在每次推送时浪费大量内存。告诉您它可以解决推送问题的人,不幸的是,通常是错的,并且往往认为它有效,因为他们特定的推送问题是间歇性的。

英文:

GitHub doesn't permit pushes larger than 2 GiB, and you're trying to push 8.64 GiB. This is too large, and you need to push in smaller chunks.

If your data is entirely in one commit, then it's too big, and you need to split it up into multiple commits.

You can use something like this, adjusting the constants (30000, origin, and main) as appropriate for your circumstance.

git rev-list --reverse --all --not --remotes=origin | ruby -ne 'x ||=0; x += 1; print $_ if x % 30000 == 0;' | xargs -I{} echo git push origin +{}:refs/heads/temp
git push origin +main :refs/heads/temp

That will push the data incrementally to a branch called temp, and then finally push the final value to main, deleting temp. If you have only a handful of commits, then you may want to change 30000 to something like 2 or even 1. This can also be done easily with Perl instead of Ruby, but that as left as an exercise for the reader.

Note that http.postBuffer should generally not be used, according to the Git FAQ. The only reason this would have any functional benefit whatever is if GitHub or a proxy server between you and GitHub didn't properly speak HTTP/1.1 by not understanding chunked transfer encoding. GitHub certainly does not have that problem, and hopefully you're not using such a proxy (because lots of things would be very broken), so all you're doing by setting that is wasting lots of memory on every push. People who are telling you it fixes push problems are, unfortunately, generally simply wrong, and tend to think it works mostly because their particular push problem is intermittent.

答案2

得分: 0

你的错误片段指示你的提交大小为8.64 GiB。你可能需要将提交大小分解成较小的块。

你还可以找到Github的存储和带宽限制,假设你正在使用Github这里

英文:

see comment https://stackoverflow.com/a/76498139/17138871

Your error snippet indicates your commit size is 8.64 GiB. You may need to break down the commit size into smaller chunks

You can also find Github's storage and bandwidth limits, assuming you're using Github here:

huangapple
  • 本文由 发表于 2023年8月4日 07:37:22
  • 转载请务必保留本文链接:https://go.coder-hub.com/76832166.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定