Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Issues with pushing large files through Git

Tags:

github

Currently when I try to push to a Git repo, I am getting the following error.

remote: error: GH001: Large files detected. remote: error: Trace: 7bbfe5c1099cfe679aa3cd1eee13e10a remote: error: See http://git.io/iEPt8g for more information. remote: error: File e3384023be667de7529538b11c12ec68.201307290946.sql.gz is 125.37 MB; this exceeds GitHub's file size limit of 100 MB 

I have gone through and made sure that this file does not exist in the directory, and have done git add -u. We have tried to prune the branch but this doesn't work as it can't find the file to delete.

like image 884
Dave Sims Avatar asked Nov 08 '13 11:11

Dave Sims


People also ask

Can Git handle large files?

Can Git Handle Large Files? Git cannot handle large files on its own. That's why many Git teams add Git LFS to deal with large files in Git.

What is the maximum file size I can push in git?

Maximum file size is 100MB Each file size will be limited to 100MB. If the file size exceeds the limit, you will receive an error message and the push will be blocked.

Can't push to GitHub because of large file?

You need to clean the Git history of your project locally, removing the unwanted big files from all of history, and then use only the 'cleaned' history going forward. The Git commit ids of the affected commits will change.


2 Answers

It is possible that you are pushing several commits, one of them including a large file, and another more recent one removing that file.

2020-2022:

Use git filter-repo (python-based, to be installed first)

And use some content-based filtering:

If you want to filter out all files bigger than a certain size, you can use --strip-blobs-bigger-than with some size (K, M, and G suffixes are recognized), e.g.:

git filter-repo --strip-blobs-bigger-than 10M 

Original answer, using obsolete tools like git filter-branch or BFG:

In any case, you can try, as explained in "Fixing the “this exceeds GitHub’s file size limit of 100 MB” error", a filter-branch (if you know the name/path of the large file that you can't see)

git filter-branch --index-filter 'git rm --cached --ignore-unmatch e3384023be667de7529538b11c12ec68.201307290946.sql.gz' <sha1>..HEAD 

Or, if you don't know but want to get rid of any large file (say > 90MB), you can use the BFG repo cleaner

bfg --strip-blobs-bigger-than 90M  my-repo.git 

That will track for you that elusive large file in your repo history and remove it.
Note that you will have to do a git push --force after that, because the history of the more recent commits will have been modified.
If others already cloned your repo before, a bit of communication is in order to warn them.

like image 90
VonC Avatar answered Sep 22 '22 23:09

VonC


In my case I fixed it with this link:

GitHub Help | Working with large files

Notice where it says giant_file

$ git filter-branch --force --index-filter \   'git rm --cached --ignore-unmatch giant_file' \   --prune-empty --tag-name-filter cat -- --all  $ git commit --amend -CHEAD  $ git push 
like image 24
user9869932 Avatar answered Sep 23 '22 23:09

user9869932