简体   繁体   English

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

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

I have some csv files that are larger than github's file size limit of 100.00 MB.我有一些大于 github 文件大小限制 100.00 MB 的 csv 文件。 I have been trying to use the Git Large File Storage extension.我一直在尝试使用 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 文件

Since Git LFS 2.2.0 you can use git lfs migrate command.从 Git LFS 2.2.0 开始,您可以使用git lfs migrate命令。 In your case it would look this way:在您的情况下,它看起来是这样的:

git lfs migrate import --include="*.csv"

After this, you should be able to push changes into origin.在此之后,您应该能够将更改推送到原点。

More information about git lfs migrate is available on Git LFS 2.2.0 release note site and git-lfs-migrate command documentation .有关git lfs migrate的更多信息,请访问Git LFS 2.2.0 发行说明站点git-lfs-migrate 命令文档

Simply adding git-lfs configuration to an existing repository will not retroactively convert your large files to LFS support.简单地将 git-lfs 配置添加到现有存储库不会追溯地将您的大文件转换为 LFS 支持。 Those large files will remain in your history and GitHub will refuse your pushes.这些大文件将保留在您的历史记录中,GitHub 将拒绝您的推送。

You need to rewrite your history to introduce git-lfs to your existing commits.你需要重写你的历史来将 git-lfs 引入你现有的提交中。 I recommend the BFG repo cleaner tool, whichadded LFS support recently.我推荐 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

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

it'll take some time if you have big project, then push it如果你有大项目需要一些时间,然后推动它

git push

I had this error:我有这个错误:

remote: error: File client/static/static-version/20171221_221446.psd is 223.61 MB;远程:错误:文件客户端/静态/静态版本/20171221_221446.psd 为 223.61 MB; this exceeds GitHub's file size limit of 100.00 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.而且因为我已经从这个文件夹中删除了这个文件,创建了 .gitignore 文件并尝试提交了几次,我不知道它被缓存了,我无法推送到 github。 In my case helped:在我的情况下帮助:

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之后就推送成功了

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.我设置了一个新的 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.我使用了 sourcetree,在输出注释中,它会针对与我的通配符匹配的大文件声明它正在提交小 txt 文件。 (sorry, I didn't record these, but it should be obvious). (对不起,我没有记录这些,但应该很明显)。

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.所以问题可能是试图将文件添加到您的历史记录中已经存在的 lfs 中。 You can only add new files.您只能添加新文件。 You can probably clean your repo of these files.您可能可以清理这些文件的存储库。

Note: I did find that quite a few files that matched my wildcards were not picked up by lfs.注意:我确实发现很多与我的通配符匹配的文件没有被 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. git lfs track "Windows/bin/myBigFile.dll"但这也无济于事。 In the end I gave up due to time constraints.最后因为时间关系放弃了。

You should also check your storage limit with gitHub.您还应该使用 gitHub 检查您的存储限制。 I purchased the extra 50gig to cover my requirements.我购买了额外的 50gig 以满足我的要求。

Cloning the repo now downloads the files separately and everything is finally working well.克隆 repo 现在可以单独下载文件,一切终于运行良好。

I have faced the same problem while some of my csv file was merged in previous commit and github rejected my push.当我的一些 csv 文件在之前的提交中合并并且 github 拒绝了我的推送时,我遇到了同样的问题。 Later I found this command which worked for me.后来我发现这个命令对我有用。

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 原帖链接

Try the following command in your terminal.在终端中尝试以下命令。 It will resolve the lfs issue.它将解决 lfs 问题。

git lfs migrate import --include="*.csv"

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:例如,如果大提交是三个之前的提交(如git status所示),您可以执行以下操作:

git rebase -i HEAD~3

Then, replace all "pick" usages after the first one with "squash" in the interactive dialog.然后,在交互式对话框中将第一个之后的所有“pick”用法替换为“squash”。

Then,然后,

git push origin --force

This solution worked for me on Ubuntu 20.04这个解决方案在 Ubuntu 20.04 上对我有用

Install the Git Large File Storage (git-lfs)安装 Git 大文件存储 (git-lfs)

sudo apt-get install git-lfs
git-lfs install

To convert any pre-existing files to Git LFS, such as files on other branches or in your prior commit history us the git lfs migrate command要将任何预先存在的文件转换为 Git LFS,例如其他分支上的文件或您之前的提交历史记录中的文件,请使用 git lfs migrate 命令

git lfs migrate import --include="*.ipynb" 

Select the file types to be tracked选择要跟踪的文件类型

git lfs track "*.ipynb"

update the gitattributes更新 git 属性

git add .gitattributes

Now push to the git git commit -m "commit message" git push现在推送到 git git commit -m "commit message" git push

And for the storage and bandwidth usage please refer有关存储和带宽使用情况,请参阅

https://docs.github.com/en/github/managing-large-files/versioning-large-files/about-storage-and-bandwidth-usage https://docs.github.com/en/github/managing-large-files/versioning-large-files/about-storage-and-bandwidth-usage

This may be help you这可能会帮助你在此处输入图像描述

Click-OriginalWebPage 点击-OriginalWebPage

Only install lfs to a exist repo may be not enough.仅将 lfs 安装到现有的 repo 可能是不够的。 Your may also change the commit history.您还可以更改提交历史记录。 Hope this is work for you .希望这对你有用。

It looks like you haven't initialised git-lfs.看起来你还没有初始化 git-lfs。 Try to type尝试输入

git lfs init

Source: Installing Git LFS来源: 安装 Git LFS

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 将代码从 Gerrit 移动到 Github 时遇到“这超出了 GitHub 的文件大小限制 100.00 MB”错误 - Facing " this exceeds GitHub's file size limit of 100.00 MB" error while moving code from Gerrit to Github .vs / slnx.sqlite超过GitHub的文件大小限制100.00 MB - .vs/slnx.sqlite exceeds GitHub's file size limit of 100.00 MB 无法将我的 React 项目推送到 Github,文件大小超过 100.00MB - Cannot push my React project to Github, file size exceeds file size of 100.00MB 推送到 GitHub 失败(这超出了 GitHub 的文件大小限制) - Failing to push to GitHub (this exceeds GitHub's file size limit) 上一次提交的文件大小限制为100.00 - File size limit of 100.00 in previous commit git push文件超过了100MB的限制 - git push file exceeds the limit of 100MB 即使在删除文件后,开发日志文件也超过了GitHub的文件大小限制 - Development Log file exceeds GitHub's file size limit, even after deleting file git rebase内部错误-超出大小限制 - git rebase internal error - exceeds size limit git lfs会减少推送到Github的文件的大小吗? - Does git lfs reduce the size of files pushed to Github? GIT错误-这超出了GitHub的文件大小限制-但该文件已被删除 - GIT error - this exceeds GitHubs file size limit - but the file has already been removed
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM