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] > 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
- Ensure actions/checkout runs earlier in the job.
- Use fetch-depth: 0 so full history is available.
- Run semantic-release from the repository root.
- uses: actions/checkout@v4
with:
fetch-depth: 0
- run: npx semantic-releaseRun 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.