将提交推送到 github 时 Git 失败 [英] Git fails when pushing commit to github

查看:32
本文介绍了将提交推送到 github 时 Git 失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我将托管在 github 上的 git 存储库克隆到我的笔记本电脑上.我能够成功地将几次提交推送到 github,没有问题.但是,现在我收到以下错误:

I cloned a git repo that I have hosted on github to my laptop. I was able to successfully push a couple of commits to github without problem. However, now I get the following error:

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 回到终端.

From here it just hangs and I finally have to CTRL + C back to the terminal.

推荐答案

我遇到了同样的问题,我认为这与您尝试使用的存储库的大小(已编辑或特定文件的大小)有关推.

I had the same issue and believe that it has to do with the size of the repo (edited- or the size of a particular file) you are trying to push.

基本上我能够创建新的存储库并将它们推送到 github.但现有的将不起作用.

Basically I was able to create new repos and push them to github. But an existing one would not work.

HTTP 错误代码似乎支持我,它是需要长度"错误.所以也许它太大而无法计算或超过最大值.谁知道呢.

The HTTP error code seems to back me up it is a 'Length Required' error. So maybe it is too large to calc or greated that the max. Who knows.

编辑

我发现问题可能是大的文件.我有一个更新即使我有,也不会推动成功推动到这一点.提交中只有一个文件但碰巧是1.6M

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

允许最大文件大小为 500M 和然后我的推动奏效了.可能是这是最初的问题通过 http 推送一个大的 repo协议.

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 之前编辑)是将我的 repo tar up,将它复制到一台可以通过 ssh 执行 git 的机器,然后将它推送到 github.然后,当您尝试从原始服务器执行推/拉操作时,它应该可以通过 https 运行.(因为它的数据量比原始推送要少得多).

the way I could get it to work (EDIT before I modified postBuffer) was to tar up my repo, copy it to a machine that can do git over ssh, and push it to github. Then when you try to do a push/pull from the original server it should work over https. (since it is a much smaller amount of data than an original push).

这篇关于将提交推送到 github 时 Git 失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆