Skip to content
LatchkeyLatchkey home

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

Using this in CI

CI checkouts are shallow and detached by default, which changes the answer this command gives you. Commands that read history, branch names, or tags need the checkout configured for it.

.github/workflows/ci.yml
- uses: actions/checkout@v4
  with:
    fetch-depth: 0   # history, tags, and git describe all need this

- run: |
    git rev-parse --is-shallow-repository   # expect false
    git rev-parse --abbrev-ref HEAD          # prints HEAD when detached

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.

Frequently asked questions

What causes Git LFS migrate import errors converting history in CI?
There are 2 common causes: a dirty working tree blocks the rewrite and the include pattern matches nothing. migrate refuses to run over uncommitted changes to avoid losing work, so a dirty checkout stops it.
How do I fix Git LFS migrate import errors converting history in CI?
There are 2 fixes depending on which cause you have: run on a clean tree with a correct pattern and preview before rewriting. Work through them in order, since the first is the most common.
What does Git LFS migrate import errors converting history in CI actually mean?
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.
How do I stop Git LFS migrate import errors converting history in CI happening again?
Run git lfs migrate info before a destructive import. The prevention section lists 3 changes that keep it from recurring.

Related guides

References

Not every red build is your code. Latchkey repairs the ones that are not, on the runner. Start free → 30-day trial · No credit card