THE GITHTML FIELD GUIDE

Handle a GitHub push rejected for a large file

A large-file push rejection concerns objects in the commits being uploaded, not only files visible in your current folder. Identify the rejected path and commit, decide whether it belongs in Git LFS or another storage mechanism, and repair unpublished history carefully. Adding .gitignore or deleting the file in a later commit does not remove the earlier object.

Identify the object and its publication state

GitHub’s documented regular-Git limit blocks files larger than 100 MiB, with a warning threshold above 50 MiB. Browser uploads have a separate limit. Read the actual server message because it identifies the offending content and can distinguish size rejection from authentication or branch policy. Do not assume every failed push is the same error.

Determine whether the large object exists only in your unpublished commits or already appears in shared history elsewhere. An unpublished mistake can often be reorganized locally; a shared-history migration requires coordination and a preservation plan. Keep the large file safely outside any cleanup until you know which storage destination is appropriate.

Inspect pending commits and choose storage

Review the commits that have not reached the intended remote branch and inspect the named file’s history. Git LFS stores pointers in Git and content separately, while release assets or an approved object store may suit distributable binaries. Database dumps and private exports may not belong in the repository at all.

  1. Replace origin/main with the actual comparison base; a new repository may have no such remote reference yet.
  2. If adopting LFS, follow the project’s verified setup and migration procedure. Tracking a pattern now does not retroactively convert every earlier ordinary Git object.
shell
git status --short --branch
git log --oneline origin/main..HEAD
git log --stat -- path/to/large-file
git show --stat HEAD

Repair the history with the smallest scope

Do not apply a broad history-rewriting command copied from an answer without verifying its targets and whether collaborators depend on them. Preserve a recovery reference and any uncommitted work, then use the project’s chosen procedure to remove or migrate the oversized object from the history being uploaded.

Afterward, inspect the pending commits again and verify the file can be retrieved through its new storage mechanism. A successful push of an LFS pointer is not sufficient if the corresponding object is unavailable. Record how consumers obtain the artifact and any relevant access or quota requirements. Avoid publishing confidential content merely to work around a size limit.

  1. If a large archive was committed and then deleted in the next commit, inspect both commits in the pending range. The earlier snapshot still requires uploading the archive’s object. A clean current directory does not establish that the upload history has been repaired.
  2. After an approved migration, test retrieval from the storage route intended for a new consumer, not only from your existing working copy. Your local cache may already contain the large asset. Confirm the published pointer or download reference resolves to the correct artifact before announcing that the size issue is fixed.

Sources and further reading

AI-assisted writing with source-linked guidance and illustrative examples. Read our editorial approach or report a correction.

All fixing git problems guides →

Read as MarkdownAll guides

Handle a GitHub push rejected for a large file · gitHtml