Skip to content

Instantly share code, notes, and snippets.

@naviocean
Created September 14, 2020 07:36
Show Gist options
  • Save naviocean/4f2cd50ece9d4cce720d2127916788cb to your computer and use it in GitHub Desktop.
Save naviocean/4f2cd50ece9d4cce720d2127916788cb to your computer and use it in GitHub Desktop.
Fixing the “GH001: Large files detected. You may want to try Git Large File Storage.”

Fixing the “GH001: Large files detected. You may want to try Git Large File Storage.”

I just migrated my repositories from BitBucket to GitHub but, suddenly, I received an interesting error when I tried to push a repo with some large files inside.

remote: error: GH001: Large files detected. You may want to try Git Large File Storage — https://git-lfs.github.com.
remote: error: Trace: b5116d865251981c96d4b32cdf7ef464
remote: error: See http://git.io/iEPt8g for more information.
remote: error: File fixtures/11_user_answer.json is 131.37 MB; this exceeds GitHub’s file size limit of 100.00 MB

It turned out that GitHub only allows for 100 MB file. The problem is that I can’t simply remove the file because it is tracked inside the previous commits so I have to remove this file completely from my repo. The command that allow you to do it is:

git filter-branch -f --index-filter 'git rm --cached --ignore-unmatch fixtures/11_user_answer.json'

At which point you can push the file to GitHub.

@Dereckz
Copy link

Dereckz commented Sep 21, 2023

Thanks!

it worked for me

@shahnawazm786
Copy link

Hi,
It is not worked for me.
Getting same error.
Thanks

@FOWnglp
Copy link

FOWnglp commented Feb 29, 2024

It is not worked for me.

@heenamadan
Copy link

same error. Not worked for me

@sololau00
Copy link

Thanks

@dollarpo7
Copy link

Worked like a charm

@partiid
Copy link

partiid commented Jun 5, 2024

That's great worked fantastic ! Thanks!

@jorgerojas26
Copy link

This worked, thanks.

@AMMISAIDFaical
Copy link

amayzing i spent time with chat gbt and some pointless searches, took just these lines to get me going thanks it worked

@syahrulhajji
Copy link

this worked thanks

@eddieh
Copy link

eddieh commented Oct 10, 2024

worked for me after accidentally committing dist/*

@nakske
Copy link

nakske commented Nov 22, 2024

thanks!!!!

@moreaki
Copy link

moreaki commented Dec 4, 2024

If you get this warning:

WARNING: git-filter-branch has a glut of gotchas generating mangled history
	 rewrites.  Hit Ctrl-C before proceeding to abort, then use an
	 alternative filtering tool such as 'git filter-repo'
	 (https://github.com/newren/git-filter-repo/) instead.  See the
	 filter-branch manual page for more details; to squelch this warning,
	 set FILTER_BRANCH_SQUELCH_WARNING=1.

The following worked for me (on macOS):

$ brew install git-filter-repo
$ git filter-repo --path path/to/file/to/be/excluded --invert-paths --force
$ git log -- path/to/file/to/be/excluded
$ git push --tags --force
$ git push --all --force

@BoutagjatBrahim
Copy link

worked very well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment