Fixing the "exceeds GitHub's file size limit" error
February 13th, 2019

This is easily done, you've zipped up your site to upload to a server and pushed to GitHub, you then get an error message like this:

remote: error: File is 214.15 MB; this exceeds GitHub's file size limit of 100.00 MB


 ! [remote rejected] master -> master (pre-receive hook declined)

error: failed to push some refs to ...

This helpful page from github has a solution. The steps are also below:


  1. Open Terminal.

  2. Change the current working directory to your local repository.

  3. To remove the file, enter git rm --cached:

    git rm --cached giant_file
    # Stage our giant file for removal, but leave it on disk
  4. Commit this change using --amend -CHEAD:

    git commit --amend -CHEAD
    # Amend the previous commit with your change
    # Simply making a new commit won't work, as you need
    # to remove the file from the unpushed history as well
  5. Push your commits to GitHub:

    git push
    # Push our rewritten, smaller commit