Codex: Not inside a trusted directory and --skip-git-repo-check was not specified.
`codex exec` refuses to run outside a Git repository, or a folder you've marked trusted, to guard against destructive changes. The exact message, why Codex prints it, and the fix.
Updated November 23, 2026 · Checked against codex exec since 2025. With --yolo it appeared on 0.63.0 to 0.87.0 (#7522, #9579) until PR #9590., reproduced in EnvHaven 1.9.0
The message
Not inside a trusted directory and --skip-git-repo-check was not specified.
What it means
codex exec refuses to run outside a Git repository, or a folder you’ve marked trusted, to guard against destructive changes. Fresh containers, CI work directories and temp folders usually aren’t Git repositories. Before late January 2026, even --yolo didn’t skip the check.
Fix
- Run Codex from inside a Git repository (
git initif the folder should be one). - Or add
--skip-git-repo-checktocodex execwhen you’re sure the directory is safe. - Or pass
--trustto save trust for the project, so later runs don’t need the flag. - On releases from before PR #9590 (merged 2026-01-23), --yolo didn’t imply the skip; update Codex.
In an EnvHaven workspace
It can: workspace folders still need Codex’s usual trust step, which the setting on its full-access page answers.
Where this comes from
This message was produced by Codex (codex exec since 2025. With --yolo it appeared on 0.63.0 to 0.87.0 (#7522, #9579) until PR #9590.) itself, in a throwaway EnvHaven 1.9.0 container, on 2026-11-23; the text above is copied from that output.