Skip to content
Latchkey

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.

git-lfs
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 them

Common 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

  1. Commit or stash local changes so the tree is clean.
  2. Use --include patterns that match the large files and --everything for all refs.
  3. Force-push the rewritten history.
Terminal
git stash
git lfs migrate import --include="*.zip,*.bin" --everything
git push --force-with-lease --all

Preview before rewriting

Use git lfs migrate info to confirm which paths and sizes will be affected before importing.

Terminal
git lfs migrate info --everything --top=20

How to prevent it

  • Run git lfs migrate info before a destructive import.
  • Perform migrations off the CI critical path, on a clean clone.
  • Coordinate the force-push so collaborators re-clone.

Related guides

Tired of flaky CI? Latchkey auto-heals failed jobs and retries them for you. Start free →