我将托管在 github 上的一个 git 存储库克隆到了我的笔记本电脑上。我能够毫无问题地成功地将几个提交推送到 github。但是,现在我收到以下错误:
Compressing objects: 100% (792/792), done.
error: RPC failed; result=22, HTTP code = 411
Writing objects: 100% (1148/1148), 18.79 MiB | 13.81 MiB/s, done.
Total 1148 (delta 356), reused 944 (delta 214)
从这里它只是挂起,我最后不得不 CTRL + C 回到终端。
最佳答案
我遇到了同样的问题,并且认为它与您尝试推送的存储库的大小(编辑后的或特定文件的大小)有关。
基本上我能够创建新的存储库并将它们推送到 github。但是现有的一个是行不通的。
HTTP 错误代码似乎支持我,它是“需要长度”错误。所以也许它太大而无法计算或大于最大值。谁知道。
编辑
I found that the problem may be files that are large. I had one update that would not push even though I had successful pushes up to that point. There was only one file in the commit but it happened to be 1.6M
So I added the following config change
git config http.postBuffer 524288000
To allow up to the file size 500M and then my push worked. It may have been that this was the problem initially with pushing a big repo over the http protocol.
结束编辑
我让它工作的方法(在我修改 postBuffer 之前进行编辑)是对我的存储库加 tar,将它复制到一台可以通过 ssh 执行 git 的机器,然后将它推送到 github。然后,当您尝试从原始服务器执行推/pull 操作时,它应该可以通过 https 工作。 (因为它的数据量比原始推送少得多)。
关于将提交推送到 github 时 Git 失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2702731/