Chromatic "git history not found" / shallow clone in CI
Chromatic walks git history to find the ancestor commit that produced the baseline snapshots. A shallow clone (the default fetch-depth: 1) hides ancestors, so Chromatic cannot establish a baseline and warns or fails.
What this error means
The chromatic step reports it could not find the baseline commit or that the git history is incomplete, often advising a full clone with fetch-depth 0.
Chromatic only has access to the current commit and cannot find baseline builds.
This usually happens when the repository is checked out with a shallow clone.
Set fetch-depth: 0 on actions/checkout.Common causes
actions/checkout uses a shallow clone by default
The default fetch-depth: 1 fetches only the latest commit, so Chromatic cannot walk back to the baseline commit.
A squashed or rebased branch lost the baseline ancestor
History rewrites can detach the branch from the commit Chromatic recorded the baseline against, leaving no common ancestor in a shallow clone.
How to fix it
Fetch full history in checkout
- Set
fetch-depth: 0on the checkout step. - Run the chromatic step after the full-history checkout.
- Re-run so Chromatic can resolve the baseline.
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: chromaui/action@latest
with:
projectToken: ${{ secrets.CHROMATIC_PROJECT_TOKEN }}Unshallow before Chromatic if needed
If you cannot change checkout, deepen the existing clone before running Chromatic.
git fetch --unshallow || trueHow to prevent it
- Use
fetch-depth: 0for any tool that reads git history, including Chromatic. - Keep the Chromatic job on the same checkout that has full history.
- Avoid rewriting history on branches that carry Chromatic baselines.