Australian cloud for business software — built and run in Sydney since 2002

NetLeverage
NetLeverage

GitHub "remote: error: GH001: Large files detected" and "this exceeds GitHub's file size limit of 100.00 MB": remove the file from the commits you are pushing, or move it to Git LFS

Technical article
Troubleshooting

About this article: This article is reviewed against the cited sources. This is source research, not lab validation. Check the stated versions and your own requirements before making changes.

When git push to GitHub ends with remote: error: GH001: Large files detected. and names a file that exceeds GitHub's file size limit of 100.00 MB, a commit in the push contains a file GitHub will not store in a normal repository. Deleting the file in a new commit does not clear it, because the commit that added it is still part of what you push. Find that commit, then amend it, move the file to Git LFS, or rewrite history.

What the error means

GitHub's page on large files says: "GitHub blocks files larger than 100 MiB." A file larger than 50 MiB gives "a warning from Git", and the push still succeeds. A file added through the browser "can be no larger than 25 MiB". To go beyond the limit, the page says "you must use Git Large File Storage (Git LFS)".

GitHub's pages print these limits, though not the full GH001 line, so treat that line as the text people search for. Check the unit: 100 MiB is 100 × 1,048,576 = 104,857,600 bytes, while 100 MB is 100,000,000 bytes. GitHub's pages use MiB.

The refusal is about commits, not about your working folder. Our own reading: Git sends every commit your branch has that the remote lacks, and a file inside any of them is checked, so a later "delete file" commit leaves the large blob in the history you push.

Likely causes

Cause What you see How to confirm
The large file is in your latest, unpushed commit Refusal right after the commit git log --stat -1 lists it
It was added in an earlier unpushed commit, then deleted The file is gone from the folder yet the push still fails git lfs migrate info finds it in the unpushed commits
A build output, database dump or archive was committed by accident A .zip, .bak, .iso or similar in the list The size table below
The file is large on purpose and was meant for Git LFS No LFS tracking in .gitattributes git lfs migrate info lists its type
The file came in with commits merged from elsewhere The refusal names a file you never added yourself git lfs migrate info lists it; this row is our own reading

Prove the cause before changing anything

All of these only read. They need Git LFS installed for the second command.

1. See what the latest commit holds.

git log --stat -1

2. List large files in the commits that are not on any remote. The Git LFS manual says that migrate "operates only on the currently checked-out branch, and only on files (of any size and type) added in commits which do not exist on any remote", and that the --above option counts files "whose individual filesize is above the given size".

git lfs migrate info --above=50MiB

The output lists, in the manual's format, a filename pattern, a total size and a ratio of files, such as *.zip 125 MB 1/1 files(s) 100%. A pattern that appears here is the one to deal with.

3. Check the exact size in bytes with your operating system's file listing and compare it with 104,857,600.

Fix

Choose by where the file entered the history. GitHub's page warns: "These procedures will permanently remove files from the repository on your computer and GitHub.com. If the file is important, make a local backup copy in a directory outside of the repository."

The file is in your latest commit and nothing is pushed

First save the current state, copying the file to a folder outside the repository (create that folder first):

cp -p GIANT_FILE /srv/backup-outside-repo/GIANT_FILE.2026-12-03

Then keep your own commits reachable by name:

git branch backup-before-amend

Risk: the next two commands remove the file from your latest commit and replace that commit. The new commit gets a new ID. The first command only unstages the file, and the git rm manual says working tree files "will be left alone".

git rm --cached GIANT_FILE
git commit --amend -CHEAD

GitHub's page shows exactly these two commands, followed by git push; the push is described under "Push the result" below.

Only if you need to back out, and only before you push, the branch goes back to the saved one and the amended commit is dropped.

Risk: the next command moves the branch back to the saved one and overwrites tracked files in your working tree; uncommitted work is lost. The reset page says --hard will "Overwrite all files and directories with the version from" the commit you name.

git reset --hard backup-before-amend

The file is large on purpose: move it to Git LFS

GitHub's page says Git LFS stores "references to the file in the repository, but not the actual file itself". Its per-file limits are 2 GB on GitHub Free and Pro, 4 GB on Team and 5 GB on Enterprise Cloud; check the current page. The page on moving files says that for an LFS limit error "you can use git lfs migrate instead of filter-repo".

First save the current state. Copy the repository's own configuration file:

cp -p .git/config .git/config.2026-12-03

Then keep your own commits reachable by name:

git branch backup-before-migrate

Risk: the next command writes the "lfs" filters into this repository's own Git configuration and, per the Git LFS manual, installs a pre-push hook for the current repository. The manual lists --local as the form that sets the filters "in the local repository's git config, instead of the global git config", meaning ~/.gitconfig, so the global file stays untouched. Restoring the saved configuration file does not remove the hook.

git lfs install --local

Only if you need to back out, the saved configuration file goes back. This is a partial back-out: it removes the filters this repository's configuration gained, and the pre-push hook stays.

Risk: the next command overwrites .git/config with the saved copy, so any other change made to that file since the save is lost.

cp -p .git/config.2026-12-03 .git/config

The fix continues after this back-out: the migration comes next, and its own back-out follows it.

Risk: the next command rewrites your unpushed local commits and gives them new IDs; it also creates or edits .gitattributes. The manual says it "will only make changes to your local repository and working copy, never any remotes".

git lfs migrate import --include="*.zip"

Confirm the result with git lfs migrate info --above=50MiB and git log, then push as described under "Push the result" below.

Only if you need to back out, and only before you push, the branch goes back to the saved one and the rewritten commits and the .gitattributes change are dropped from it.

Risk: the next command moves your branch back to the saved one and overwrites files in your working tree, so uncommitted work is lost.

git reset --hard backup-before-migrate

The file is in history that is already pushed or shared

GitHub's page recommends git filter-repo, and says an interactive rebase needs the commits to be known and that the "commit(s) must be part of only one branch", which must have "had no merges since". GitHub's page on removing sensitive data from a repository says rewriting history "has a number of side effects that must be managed", including changed commit hashes, and that the rewrite "becomes irreversible" at the force-push step. That page describes the rewrite as a separate procedure, which starts with "Clone the repository to your local computer", so no commands for it appear here.

For files that only need distributing, GitHub's page suggests releases: "Releases allow you to package software, release notes, and links to binary files".

Push the result

First save the current state: record the remote's tip, in a file outside the repository so that it cannot be committed by accident.

git ls-remote origin main > ../remote-tip-before.txt

Risk: the next command publishes your commits to the shared branch. A push cannot be recalled from anyone who fetches afterwards.

git push origin main

Only if you need to back out: a pushed commit cannot be taken back from people who have fetched it. The saved file ../remote-tip-before.txt records the remote tip from before your push; its first column is the commit ID.

Example (illustrative): On build-agent1 a job committed db-export.zip, 125,829,120 bytes (120 MiB), and then a second commit deleted it. git push is refused with GH001. 125,829,120 - 104,857,600 = 20,971,520 bytes (20 MiB) over the limit. git lfs migrate info --above=50MiB lists *.zip with one file. The administrator saves backup-before-migrate, runs git lfs migrate import --include="*.zip" and pushes. Both commits are rewritten, and the push succeeds.

Confirm the fix

  1. git push ends without GH001.
  2. git lfs migrate info --above=50MiB lists no unpushed large file you did not intend.
  3. The file opens normally in a fresh clone after git lfs install.

What to watch afterwards

  • Add build outputs and dumps to .gitignore; our own advice.
  • GitHub's page recommends repositories "ideally less than 1 GB" and says "less than 5 GB is strongly recommended".
  • It also says "Git is not designed to serve as a backup tool."

Risks and limits

  • These commands have not been run or lab-tested.
  • Rewriting history changes commit IDs; if anyone has your earlier commits, this needs agreement.
  • A pushed rewrite is the point at which GitHub's page says it "becomes irreversible".
  • Limits and plan figures belong to GitHub and change: check the current page.

Sources