The following is what worked for me the best and easiest when trying to reduce the size of a GitHub repo.
Download bfg.jar
from this site: http://rtyley.github.io/bfg-repo-cleaner/ (discovered here: http://stackoverflow.com/a/15771042)
Rename bfg.#####.jar
to bfg.jar
and put it in your root /github
repo folder.
Run the following commands:
git clone --mirror git@github.com:CMN/YourRepoName.com.git
ditto YourRepoName.com.git YourRepoName.com.backup.git
java -jar bfg.jar --strip-biggest-blobs 500 YourRepoName.com.git
cd YourRepoName.com.git
git reflog expire --expire=now --all
git gc --prune=now --aggressive
git push
You might want to check/double-check the size of the repo before you push it back, but this works. I added the ditto
command which will create a backup of your .git
repo so you not only can compare the filesize, but will have a backup of your repo in case something goes wrong. The repo I ran this on went from 500+megs to 117megs.