Git lfs - “这超出了 GitHub 的 100.00 MB 文件大小限制”

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/33330771/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-09 03:39:33  来源:igfitidea点击:

Git lfs - "this exceeds GitHub's file size limit of 100.00 MB"

gitgithublarge-filesgit-lfs

提问by LearningSlowly

I have some csv files that are larger than github's file size limit of 100.00 MB. I have been trying to use the Git Large File Storage extension.

我有一些大于 github 文件大小限制 100.00 MB 的 csv 文件。我一直在尝试使用 Git 大文件存储扩展。

https://git-lfs.github.com/

https://git-lfs.github.com/

From LFS - "Large file versioning- Version large files—even those as large as a couple GB in size—with Git."

从 LFS - "Large file versioning- Version large files—even those as large as a couple GB in size—with Git."

I have applied the following on the folders of concern:

我已对相关文件夹应用以下内容:

git lfs track "*.csv"

However, when I push:

但是,当我推动时:

remote: error: File Time-Delay-ftn/Raw-count-data-minor-roads1.csv is 445.93 MB; this exceeds GitHub's file size limit of 100.00 MB
remote: error: File Time-Delay-ftn/Raw-count-data-major-roads.csv is 295.42 MB; this exceeds GitHub's file size limit of 100.00 MB

When I look at the folder in question:

当我查看相关文件夹时:

-rw-r-----   1 user  staff    42B 23 Oct 12:34 .gitattributes
-rw-r--r--   1 user  staff   1.3K 19 Oct 14:32 DfT_raw_major_manipulation.py
-rw-r--r--   1 user  staff   1.2K 16 Oct 15:08 DfT_raw_minor_manipulation.py
drwxr-xr-x  21 user  staff   714B 22 Oct 11:35 Driving/
-rwxr-xr-x@  1 user  staff   295M 19 Oct 14:47 Raw-count-data-major-roads1.csv*
-rwxr-xr-x@  1 user  staff   446M 16 Oct 14:52 Raw-count-data-minor-roads1.csv*

when I vim the .gitattributes file you can see the lfs setup:

当我 vim .gitattributes 文件时,您可以看到 lfs 设置:

*.csv filter=lfs diff=lfs merge=lfs -text

What am I doing wrong?

我究竟做错了什么?

UPDATE

更新

When I query

当我查询

git lfs ls-files

I get nothing returned. This indicates that despite the .csv filter being successfully applied to the .gitattributes file the csv files are not being picked up by lfs

我什么也得不到。这表明尽管 .csv 过滤器已成功应用于 .gitattributes 文件,但 lfs 并未获取 csv 文件

采纳答案by Edward Thomson

Simply adding git-lfs configuration to an existing repository will not retroactively convert your large files to LFS support. Those large files will remain in your history and GitHub will refuse your pushes.

简单地将 git-lfs 配置添加到现有存储库不会追溯将您的大文件转换为 LFS 支持。这些大文件将保留在您的历史记录中,GitHub 将拒绝您的推送。

You need to rewrite your history to introduce git-lfs to your existing commits. I recommend the BFG repo cleaner tool, which added LFS supportrecently.

您需要重写历史记录以将 git-lfs 引入现有提交。我推荐 BFG repo 清洁工具,它最近添加了 LFS 支持

You should be able to convert historical usage of your CSV files by:

您应该能够通过以下方式转换 CSV 文件的历史使用情况:

$ java -jar ~/bfg-1.12.5.jar --convert-to-git-lfs '*.csv' --no-blob-protection

回答by Philip Taylor

I hit the same problem yesterday and cracked it. I was unable to push, and it appeared that none of my big files were in lfs.

我昨天遇到了同样的问题并破解了它。我无法推送,而且我的大文件似乎都没有在 lfs 中。

There is probably a better way, but this worked for me. I have a large repo with 2.5 gigs of data.

可能有更好的方法,但这对我有用。我有一个包含 2.5 演出数据的大型存储库。

I setup a new repo then setup lfs in it. git lfs init

我设置了一个新的 repo,然后在其中设置了 lfs。 git lfs init

I then configured my various file types git lfs track "*.pdb" git lfs track "*.dll" I then commmited my changes and pushed.

然后我配置了我的各种文件类型 git lfs track "*.pdb" git lfs track "*.dll" ,然后我提交了我的更改并推送。

I then added my big files. I used sourcetree, and in the output notes it would state for the big files matching my wildcards that it was committing tiny txt file instead. (sorry, I didn't record these, but it should be obvious).

然后我添加了我的大文件。我使用了 sourcetree,在输出注释中,它会为匹配我的通配符的大文件声明它正在提交小 txt 文件。(抱歉,我没有记录这些,但应该很明显)。

Then I pushed, and I saw 'skipping files', and the push succeeded quickly.

然后我推送,看到‘跳过文件’,推送很快就成功了。

so the problem is probably trying to add files to lfs that are already in your history. You can only add new files. You can probably clean your repo of these files.

所以问题可能是试图将文件添加到你历史中已经存在的 lfs 中。您只能添加新文件。您可能可以清理这些文件的存储库。

Note: I did find that quite a few files that matched my wildcards were not picked up by lfs. Similar files in different folders were picked up, but not all. I tried explicitly adding these files using the full path. git lfs track "Windows/bin/myBigFile.dll" but that didn't help either. In the end I gave up due to time constraints.

注意:我确实发现很多与我的通配符匹配的文件都没有被 lfs 选中。提取了不同文件夹中的类似文件,但不是全部。我尝试使用完整路径显式添加这些文件。 git lfs track "Windows/bin/myBigFile.dll" 但这也无济于事。最后因为时间关系放弃了。

You should also check your storage limit with gitHub. I purchased the extra 50gig to cover my requirements.

您还应该使用 gitHub 检查您的存储限制。我购买了额外的 50gig 以满足我的要求。

Cloning the repo now downloads the files separately and everything is finally working well.

克隆 repo 现在单独下载文件,一切终于运行良好。

回答by Yarik

I had this error:

我有这个错误:

remote: error: File client/static/static-version/20171221_221446.psd is 223.61 MB; this exceeds GitHub's file size limit of 100.00 MB

远程:错误:文件客户端/静态/静态版本/20171221_221446.psd 为 223.61 MB;这超出了 GitHub 的文件大小限制 100.00 MB

And because I already removed this file from this folder, created .gitignore file and tried to commit couple times, I didn't know that it was cached, I could not push to github. In my case helped:

因为我已经从这个文件夹中删除了这个文件,创建了 .gitignore 文件并尝试提交几次,我不知道它被缓存了,我无法推送到 github。在我的情况下帮助:

git filter-branch --index-filter 'git rm --cached --ignore-unmatch client/static/static-version/20171221_221446.psd'

git filter-branch --index-filter 'git rm --cached --ignore-unmatch client/static/static-version/20171221_221446.psd'

Where I placed full file path(from error above) to remove it from cache. After that, push was made successfully

我放置完整文件路径(来自上面的错误)以将其从缓存中删除的位置。之后,推送成功

回答by avijit bhattacharjee

I have faced the same problem while some of my csv file was merged in previous commit and github rejected my push. Later I found this command which worked for me.

我遇到了同样的问题,而我的一些 csv 文件在之前的提交中被合并,而 github 拒绝了我的推送。后来我发现这个命令对我有用。

git filter-branch -f --index-filter 'git rm --cached --ignore-unmatch fixtures/11_user_answer.json'
# for my case
git filter-branch -f --index-filter 'git rm --cached --ignore-unmatch tensorflow.csv'

Original post link

原帖链接

回答by Jignesh Sanghani

i had same issue, but it's resolved using filter-branch

我有同样的问题,但它解决了使用 filter-branch

git filter-branch --tree-filter 'rm -rf path/to/your/file' HEAD

git filter-branch --tree-filter 'rm -rf path/to/your/file' HEAD

it'll take some time if you have big project, then push it

如果你有大项目,需要一些时间,然后推动它

git push

git push

回答by Eric

If you know which commit introduced the large commit, you could also try squashing that commit with the subsequent commits that introduced Git LFS.

如果您知道哪个提交引入了大提交,您还可以尝试使用引入 Git LFS 的后续提交压缩该提交。

For example, if the large commit was three commits ago (as revealed by git status), you could do the following:

例如,如果大提交是 3 次之前的提交(如 所示git status),您可以执行以下操作:

git rebase -i HEAD~3

Then, replace all "pick" usages after the first one with "squash" in the interactive dialog.

然后,在交互式对话框中用“squash”替换第一个之后的所有“pick”用法。

Then,

然后,

git push origin --force

回答by anKotliner

This may be help you enter image description here

这可能会帮助你 在此处输入图片说明

Click-OriginalWebPage

单击原始网页

Only install lfs to a exist repo may be not enough. Your may also change the commit history. Hope this is work for you .

仅将 lfs 安装到现有存储库可能还不够。您还可以更改提交历史记录。希望这对你有用。

回答by hombit

It looks like you haven't initialised git-lfs. Try to type

看起来您还没有初始化 git-lfs。尝试打字

git lfs init

Source: Installing Git LFS

来源:安装 Git LFS