OpenAI Codex · tool · fg-0497

codex exec exits 1 with 'Not inside a trusted directory and --skip-git-repo-check was not specified'

If you see Not inside a trusted directory and --skip-git-repo-check was not specified, the cause and the fix for OpenAI Codex are below, last verified 2026-10-15.

Verified Oct 2026trust 50/100
Symptom
Not inside a trusted directory and --skip-git-repo-check was not specified.Happens in Docker or CI workspaces without a .git folder, even with --yolo
Cause
Codex requires commands to run inside a Git repository as a guard against destructive changes, and the full-access flags do not lift that check.
Fix
Run inside a Git repository (git init works for scratch workspaces), or add --skip-git-repo-check in an environment you control.
Apply
codex exec --skip-git-repo-check --sandbox workspace-write "task"
Affected
Codex CLI codex exec, as of 2026-10
Sources

Last verified 2026-10-15 · Confirmed by 0 builders

Related traps

Have your agent know this before it fails

$ /plugin marketplace add getfootgun/footgun
$ /plugin install footgun@footgun