Github文件大小限制在2013年6月18日更改。现在无法推送。

29
这个2013年6月18日的变更会如何影响我现有的超出文件大小限制的仓库?我最后一次推送是两个月前,当时包含一个大文件。
我已经在本地删除了一个大文件,但现在无法推送任何内容。我收到一个“远程错误”的提示...remote: error: File cron_log.log is 126.91 MB; this exceeds GitHub's file size limit of 100 MB。
我在原始推送之后将该文件添加到.gitignore中...但它仍然存在于远程(origin)上。
在本地删除它应该会摆脱它在远程(Github)上的存在,对吗?...但是...由于Github上存在一个超出限制的文件,它不允许我推送。

https://github.com/blog/1533-new-file-size-limits

这些是我输入的命令以及错误信息:
git add .
git commit -m "delete cron_log.log"
git push origin master

remote: Error code: 40bef1f6653fd2410fb2ab40242bc879
remote: warning: Error GH413: Large files detected.
remote: warning: See http://git.io/iEPt8g for more information.
remote: error: File cron_log.log is 141.41 MB; this exceeds GitHub's file size limit of 100 MB
remote: error: File cron_log.log is 126.91 MB; this exceeds GitHub's file size limit of 100 MB
To https://github.com/slinds(此处省略)/linexxxx(此处省略).git ! [remote rejected] master -> master (pre-receive hook declined) error: failed to push some refs to 'https://github.com/slinds(此处省略)
然后我尝试了一些其他操作。
git rm cron_log.log
git rm --cached cron_log.log

相同的错误。

2
你能用命令解释一下你到目前为止所做的事情以删除文件吗? - manojlds
1
好的,请问 git log --oneline origin/master..master 的输出是什么?还有 find . -iname 'cron_log.log' 的输出是什么? - Chronial
git log --oneline origin/master..master 52301a7 6月29日 - 2 abd7340 6月29日 61afb32 6月29日 8cd2ffd 更新6月14日 - slindsey3000
@Chronial 的输出在上方。 - slindsey3000
你可以编辑你的问题以产生这样的输出 :) - Chronial
显示剩余4条评论
6个回答

26
rlb.usa所述,Github已经增加了文件大小限制,防止您上传大于100MB的文件。 您尝试在新提交中删除文件并尝试推送该文件。 这会失败,因为您不仅要推送最后一个提交,还要推送其他三个提交。 这三个提交包含的cron_log版本大小分别为141MB和126MB。 它们导致您的推送失败。
要解决此问题,您有两个选择:
  • 运行 git rebase -i origin/master ,将每个提交设置为编辑状态,并在每个提交中使用 git commit --amend 删除该文件。
  • 使用BFG Repo-Cleaner清除您的所有历史记录。

4
在这里使用TortoiseGit。我选择了Fetch&Rebase而不是Pull,然后得到了一份冲突文件列表。删除相关的文件后,提交并推送,这样就解决了。 - m.spyratos
希望能够提供更详细的指示。 - posfan12

26

1
使用此功能时要小心,如果您使用了CocoaPods,它可能会取消链接所有的库。我是吃过亏才知道的。 - jusynth

6
根据GitHub的新文件大小限制(还有:处理大型文件),该政策仅在几个小时前开始实行,现在GitHub拥有1GB文件大小的存储库,对于超过50MB的文件推送提供警告,并完全拒绝100MB文件上传。

当您推送大于50 MB的文件时,GitHub会向您发出警告。 包含超过100 MB文件的推送将被拒绝。 我们这样做由于一些原因。

您有几个选项,但并不多:

  • 将100MB以上的文件上传到其他服务中,并与其共享
  • 减小问题文件的文件大小
  • 找一个新的存储库

10
我只想删除这个文件...但似乎无法做到。 - slindsey3000
1
@slindsey3000我知道。我们也遇到过这个问题。我记得听说有些人通过联系GitHub支持成功摆脱了他们的大文件。 - rlb.usa
1
你忘记了分割和重新组合文件。 - Gianluca Ghettini

1
每个GitHub文件的实际限制为100 MiB,而不是100 MB。
演示:https://github.com/Franck-Dernoncourt/github-max-file-size

https://help.github.com/articles/what-is-my-disk-quota/( 镜像)错误地声称他们对超过100 MB的文件有严格限制。

在推送时可以看到MB和MiB之间的混淆:在下面的示例中,GitHub服务器的错误消息显示该文件大小为101 MB,而git正确地指出它是101 MiB:

~\Documents\GitHub\test123 [master ↑1 +3 ~0 -0 !]> git push
Counting objects: 3, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (3/3), done.
Writing objects: 100% (3/3), 101.03 MiB | 896.00 KiB/s, done.
Total 3 (delta 1), reused 0 (delta 0)
remote: Resolving deltas: 100% (1/1), completed with 1 local objects.
remote: error: GH001: Large files detected. You may want to try Git Large File S
torage - https://git-lfs.github.com.
remote: error: Trace: e9206a9cd05c4ff5de79bba9d4caf9df
remote: error: See http://git.io/iEPt8g for more information.
remote: error: File 101MB is 101.00 MB; this exceeds GitHub's file size limit of
 100.00 MB
To https://github.com/Franck-Dernoncourt/test123.git
 ! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://github.com/Franck-Dernoncourt/test12
3.git'
~\Documents\GitHub\test123 [master ↑1 +3 ~0 -0 !]>

0

我尝试了上面几个答案,但都没有成功。但最终我找到了一个使用Github桌面版的解决方案。点击“仓库”,然后选择“撤销最近的提交”。它允许我这样做两次,刚好足够删除有问题的提交。(我已经从仓库中删除了大文件)。


0

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接