Recently, we’re migrating the repository from bitbucket to github, while pushing changes to my GitHub repository, I encountered the following error:
1 | remote: error: File mock-data/OTAMockDataGenerator/project.log is 113.39 MB; this exceeds GitHub's file size limit of 100.00 MB |

GitHub restricts file uploads to 100 MB. In my case, these .log files were not essential for version control, but they were already committed. Here’s how I resolved the issue and some best practices for handling large files in Git.
1. Removing Large Files from History with git filter-repo
If we’ve already committed large files, simply deleting them and pushing won’t work—they remain in our repository history. To completely remove them, use git filter-repo:
Step-by-step:
Install git-filter-repo
On Windows, use Python pip:1
pip install git-filter-repo
Remove the unwanted files from history:
1
git filter-repo --path mock-data/OTAMockDataGenerator/project.log --path mock-data/OTADataGenerator/project.log --invert-paths
This command deletes the specified files from all commits.
Force-push the cleaned history:
1
git push --force
Warning: Force-pushing rewrites history. Coordinate with collaborators before proceeding.
Add
.logfiles to.gitignore
Prevent future accidental commits:1
2
3
4echo "*.log" >> .gitignore
git add .gitignore
git commit -m "Ignore log files"
git push
2. Managing Large Files with Git Large File Storage (LFS)
Alternative way, if you need to track large files (e.g., datasets, binaries), consider Git LFS:
Setup:
Install Git LFS:
Download and install from git-lfs.github.com.Track large file types:
1
2
3
4
5
6git lfs track "*.log"
git add .gitattributes
git add mock-data/OTAMockDataGenerator/project.log
git add mock-data/OTADataGenerator/project.log
git commit -m "Track log files with LFS"
git push
Note:
Git LFS stores large files outside the main repository, keeping your repo lightweight. However, GitHub LFS has its own storage limits and may incur costs for very large datasets.
Summary
- Use
git filter-repoto clean up large, unnecessary files from your repo history. - Add file patterns to
.gitignoreto prevent future issues. - For essential large files, use Git LFS.
By following these steps, we can keep our repository clean, efficient, and compliant with GitHub’s file size policies.