Blog

Git error “File abc.zip is 116.61 MB; this exceeds GitHub’s file size limit of 100.00 MB”

Share your learning

Sometimes we accidentally forget to remove unwanted backup zip files or we might have some of the large size files available in the git local repo. Now when we try to commit and push this code to the git, it starts throwing an error.

To resolve the issue of exceeding the file size limit on GitHub, you have a few options:

Solution for git large file issue

Remove the large file:

If the file abc.zip is not essential to the repository or if it can be regenerated or downloaded separately, you can consider removing it from the repository altogether. This will immediately resolve the issue.
You can use the following steps:

  1. Delete the file from your local repository.
  2. Commit the deletion:
    git commit -m "Remove large file abc.zip".
  3. Push the changes to GitHub:
    git push origin

Git Large File Storage (Git LFS):

If the file is necessary to keep in the repository, you can use Git LFS to manage large files separately. Git LFS replaces the large file with a pointer to the file, while storing the actual file content on a remote server.
Here’s how you can set up Git LFS:

  • Install Git LFS by following the instructions for your operating system:
    https://git-lfs.github.com/
    .
  • Initialize Git LFS in your repository: git lfs install
  • Track the large file(s) using Git LFS: git lfs track "path/to/abc.zip"
  • Commit and push the changes:
git add .gitattributes //(to track the .gitattributes file)

git add abc.zip

git commit -m "Add large file abc.zip"

git push origin <branch-name>.

Make sure to replace <branch-name> with the appropriate branch name.

Git Large File Storage (LFS) with alternative hosting:

If you prefer not to use Git LFS, you can consider hosting the large file elsewhere, such as a cloud storage service (e.g., Google Drive, Dropbox), and provide a download link or instructions in your repository’s README file for others to access the file.

  1. Upload the abc.zip file to a cloud storage service.
  2. Update your repository’s README file with instructions on how to download the file or provide a direct download link.
  3. Commit and push the changes to GitHub:
git add README.md (or the appropriate file),

git commit -m "Update README with file download instructions"

git push origin

Still encounter with the error even after removing the large file

If you have removed the large file abc.zip from your local repository and committed the changes, but you are still encountering the same error when pushing to GitHub, it’s possible that the large file is still present in the Git history.

In that case, you’ll need to rewrite the Git history to completely remove the file from the repository.

Remove the file from git history

To remove the file from Git history and resolve the issue, you can follow these steps:

  1. Install and set up the BFG Repo-Cleaner:
    a. Download the BFG Repo-Cleaner JAR file from the following link: https://rtyley.github.io/bfg-repo-cleaner/.
    b. Save the JAR file to a convenient location on your computer.
  2. Create a backup of your repository:
    Before performing any major changes to your Git repository, it’s always a good practice to create a backup. Copy the entire repository directory to another location on your computer.
  3. Open a command prompt or terminal window and navigate to your git repository directory.
  4. Run the following command to remove the large file from the Git history:
java -jar /path/to/bfg.jar --delete-files abc.zip<br>

This command instructs BFG Repo-Cleaner to remove the file abc.zip from the repository’s history.

After BFG Repo-Cleaner completes the cleanup process, the repository’s history will be modified. To finalize the changes, run the following command:

git reflog expire --expire=now --all && git gc --prune=now --aggressive

This command expires old reflog entries and performs a garbage collection to remove the unwanted objects from the repository.

Now you can push the updated repository to GitHub:

git push origin <branch-name> --force

Replace <branch-name> with the appropriate branch name.

Summary

By following these steps, the large file should be completely removed from the repository’s history, allowing you to push the changes to GitHub without encountering the file size limit error. However, note that rewriting history can be a destructive operation, so make sure you have a backup of your repository before proceeding.

Satpal

Recent Posts

How to Switch PHP Versions in XAMPP Easily: Managing Multiple PHP Versions on Ubuntu

Today we are going to learn about managing multiple PHP versions on ubuntu with xampp.…

1 year ago

How to Use Coding to Improve Your Website’s SEO Ranking?

Let's understand about how to use coding to improve your website's SEO. In today’s computerized…

1 year ago

Most Important Linux Commands for Web Developers

Let's understand the most important linux commands for web developers. Linux, as an open-source and…

1 year ago

Top 75+ Laravel Interview Questions Asked by Top MNCs

Today we are going to discuss top 75+ Laravel interview questions asked by top MNCs.Laravel,…

1 year ago

Mailtrap Integration for Email Testing with Laravel 10

Today we will discuss about the Mailtrap integration with laravel 10 .Sending and receiving emails…

1 year ago

Firebase Cloud Messaging (FCM) with Ionic 6: Push Notifications

Today we are going to integrate FCM (Firebase Cloud Messaging) push notifications with ionic application.Firebase…

1 year ago