When working with large data or heavy dependencies, it’s not uncommon for repositories to exceed GitHub’s 100MB file size limit. If you’re migrating from GitLab to GitHub and encounter this issue, you’ll need to clean your repo history and strip out large files before pushing.
In this post, I’ll walk you through how to successfully import your GitLab repo to GitHub while removing large files and their history using git-filter-repo
.
🚧 The Problem
During a migration, you may run into an error like:
GitHub strictly enforces a 100MB limit on individual files. Large files such as .hprof
, .csv
, .zip
, or binary artifacts can block your push — even if they were deleted in a later commit.
This happens because Git stores the entire commit history, including past versions of large files. So even a long-deleted file can cause a migration to fail.
Step-by-Step Solution
1. Clone Your GitLab Repo
Use --mirror
so you get the full history and all branches/tags.
2. Identify Large Files (Optional)
To see which files are problematic, you can use:
But GitHub’s error message will often give you the exact file paths and sizes.
3. Create a File List
Create a text file named files-to-remove.txt
with the paths of the large files. For example:
4. Remove Large Files From History
Install git-filter-repo
if you haven’t already:
Then run:
This will rewrite your repo history, excluding the listed files.
5. Push to GitHub
Now you’re ready to push the cleaned repo:
git remote add github https://github.com/your-user/your-repo.git