Git LFS migrate import errors converting history in CI
git lfs migrate import rewrites commits so large files become pointers. It fails or does nothing when no include pattern matches, the tree is dirty, or the rewritten history is not force-pushed.
What this error means
git lfs migrate import reports "migrate: no files to migrate", refuses on an unclean working tree, or the remote still rejects large files because the rewrite was not pushed.
migrate: override changes in your working copy? [Y/n]
migrate: working copy must not be dirty
Error: run 'git status' to see the changes, then commit or stash themCommon causes
A dirty working tree blocks the rewrite
migrate refuses to run over uncommitted changes to avoid losing work, so a dirty checkout stops it.
The include pattern matches nothing
An --include that does not match the large files means migrate finds nothing to convert and history is unchanged.
How to fix it
Run on a clean tree with a correct pattern
- Commit or stash local changes so the tree is clean.
- Use
--includepatterns that match the large files and--everythingfor all refs. - Force-push the rewritten history.
git stash
git lfs migrate import --include="*.zip,*.bin" --everything
git push --force-with-lease --allPreview before rewriting
Use git lfs migrate info to confirm which paths and sizes will be affected before importing.
git lfs migrate info --everything --top=20How to prevent it
- Run
git lfs migrate infobefore a destructive import. - Perform migrations off the CI critical path, on a clean clone.
- Coordinate the force-push so collaborators re-clone.