Turborepo "unable to calculate hash" in CI
turbo hashes task inputs to decide cache hits, and it relies on git to enumerate files fast. When git is missing, the checkout is unusual, or an input path is outside the workspace, turbo cannot compute the hash and the task fails.
What this error means
turbo fails with "unable to calculate hash" or "could not calculate file hash for ...", often mentioning a git or file access problem.
Turborepo
x unable to calculate file hash
could not read file ...: git ls-tree failedCommon causes
git is unavailable or the checkout is unusual
turbo uses git to hash inputs. A missing git binary, a detached or partial checkout, or a submodule quirk breaks hashing.
An input path resolves outside the workspace
A globalDependencies or inputs glob pointing outside the repo cannot be hashed.
How to fix it
Ensure a normal git checkout
- Use
actions/checkoutso the repo is a real git working tree. - Avoid manual tarball checkouts that leave no
.git. - If you filter by affected, use
fetch-depth: 0so refs exist.
.github/workflows/ci.yml
- uses: actions/checkout@v4
with:
fetch-depth: 0Keep input globs inside the workspace
Point inputs and globalDependencies at paths within the repo so every input is hashable.
turbo.json
{
"globalDependencies": ["tsconfig.base.json", ".env.example"]
}How to prevent it
- Check out with git so turbo can hash via git.
- Keep
inputs/globalDependenciesinside the workspace. - Use
fetch-depth: 0when combining with affected filters.
Related guides
Turborepo --filter affected needs a base ref (full history) in CIFix Turborepo --filter affected selecting nothing or erroring in CI - the [ref] base is not in the shallow cl…
Turborepo "no output files found for task" (cache saves nothing) in CIFix Turborepo "no output files found for task" in CI - the task declares no matching outputs, so turbo caches…
Turborepo "could not find turbo.json" in CIFix Turborepo "could not find turbo.json" in CI - turbo runs outside the repo root or the config file is miss…