How to totally remove a too big file from your github repository

Oops, you added a too big file on your github repository, and… no way to totally remove it from your history.

github file too big 100mb

Oh, wait, there is a workarround, thanks to Roberto Tyley, aka @rtyley and his bfg-repo-cleaner, a very simple java cli tool.

How to use it

First, you have to download it from https://rtyley.github.io/bfg-repo-cleaner/ , and follow the steps.

In a few words…

$ wget "https://repo1.maven.org/maven2/com/madgag/bfg/1.13.0/bfg-1.13.0.jar"
$ java -jar bfg.jar --strip-blobs-bigger-than 100M .git
$ git reflog expire --expire=now --all && git gc --prune=now --aggressive
$ git push

Little easter-egg, when the command succedeed, you will see a little political message…

You can rewrite history in Git - don't let Trump do it for real!

You can follow Roberto on twitter: @rtyley, and discover other repositories he made directly on his github: https://github.com/rtyley?tab=repositories.

Written on April 19, 2019