Skip to content
Latchkey

semantic-release "ENOTINGITREPOSITORY" not in a git repository in CI

semantic-release reads git history to decide the next version, so it must run inside a git working tree. When the step runs in a directory with no .git, it aborts with ENOTINGITREPOSITORY.

What this error means

The run fails immediately with "ENOTINGITREPOSITORY The semantic-release command must be run from a git repository."

semantic-release
[semantic-release] > ENOTINGITREPOSITORY Not running from a git repository.
The semantic-release command must be executed from a Git repository.

Common causes

The checkout step was skipped

The job never ran actions/checkout, so the workspace has code copied some other way with no .git directory.

The step runs in the wrong working directory

A working-directory or cd moved out of the repository root into a folder that is not part of the git tree.

How to fix it

Add a checkout before the release

  1. Ensure actions/checkout runs earlier in the job.
  2. Use fetch-depth: 0 so full history is available.
  3. Run semantic-release from the repository root.
.github/workflows/release.yml
- uses: actions/checkout@v4
  with:
    fetch-depth: 0
- run: npx semantic-release

Run from the git root in monorepos

If a package lives in a subfolder, run semantic-release with the repo checked out and point config at the package rather than cd-ing outside the tree.

How to prevent it

  • Always check out the repository before running semantic-release.
  • Keep the release step in the git working tree.
  • Use fetch-depth: 0 so history is complete for analysis.

Frequently asked questions

What causes ""ENOTINGITREPOSITORY""?
The job never ran actions/checkout, so the workspace has code copied some other way with no .git directory.
How do I fix "ENOTINGITREPOSITORY"?
Add a checkout before the release

Related guides

References

Latchkey auto-heals failures like this one - detected, fixed, and retried without you. Start free → 30-day trial · No credit card