GitHub Error GH001: Large files detected - FIX How to fix a common GH001 GitHub error that doesn't allow the user to push because of files being too big

How to check the first commit date of any Git repository

If you've stumbled upon this post, there's a high chance that you are dealing with a nasty GitHub bug that can happen when you try to push a commit that includes some large files.

When this happens, the git client you use to perform the push will give you error messages similar to these ones:

remote: error: File <File Path> is 120.11 MB; this exceeds GitHub's file size limit of 100.00 MB
remote: error: GH001: Large files detected. You may want to try Git Large File Storage -

! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to <Project Name>

git did not exit cleanly (exit code 1)

Such errors are typically hit by web designers, since they usually deal with media files such as HQ images, videos, and the likes, which are often way bigger in size if we compare them with most source code files used by software developers: however, this can also happen frequently when using web frameworks such as Angular together with module bundlers like WebPack, as they can create huge JavaScript files.

These files are rejected by GitHub because that service has an hard-cap of 100 MB per single file, leaving us with two options:

  • Remove the offending files
  • Untrack and/or exclude those files from git (as explained in the official github docs).

Unfortunately, when the above error strikes it means that we've already committed those files in our local repository, meaning that we can't simply "ignore" them anymore: we need to find a way to delete those files from our local repository. More precisely, we need to "roll back" to the moment before the commit, without losing the updated files: if we manage to do that, we'll be able to manually delete (or exclude) the offending files without losing our work.

Here's a simple guide explaining how to do that.

  • Open a command prompt and navigate to the project's root folder (the folder hosting the .git hidden directory)
  • Execute the following command on the master branch:
    • git status
  • Take note of how many commits you are ahead of the origin/master branch by looking at the command output. For example, if the command says that "Your branch is ahead of 'origin/master' by 2 commits", the number to remember is 2, which you'll have to put instead of the <num> placeholder we'll be using in the following command.
  • Execute the following command to move the current HEAD of your local repository back to the commit specified, i.e. to the moment before the commit of these large files (don't worry, you won't lose any of your updated files):
    • git reset HEAD~<num>
  • After doing that, execute the status command again:
    • git status
  • The command output should now say that Your branch is up to date with 'origin/master'.

That's it! Now you can finally delete the large files (unless you haven't already done so); after that, you'll be able to re-commit everything without losing your work. Credits for this solution goes to Shreya (see this StackOverflow thread).

For further info about the git reset command, read the official docs.


That's it, at leastr for now: we hope that such method will help other web designers and software developers that are struggling with this nasty GitHub issue.


About Ryan

IT Project Manager, Web Interface Architect and Lead Developer for many high-traffic web sites & services hosted in Italy and Europe. Since 2010 it's also a lead designer for many App and games for Android, iOS and Windows Phone mobile devices for a number of italian companies. Microsoft MVP for Development Technologies since 2018.

View all posts by Ryan

Leave a Reply

Your email address will not be published. Required fields are marked *

The reCAPTCHA verification period has expired. Please reload the page.

This site uses Akismet to reduce spam. Learn how your comment data is processed.