Skipping repository checks lets Codex run a non-interactive exec task from a directory that is not inside a Git working tree, which is useful for one-off prompts in scratch folders or temporary workspaces.
Current Codex CLI behavior requires codex exec to start inside a Git repository by default and uses the --skip-git-repo-check flag as the override when that repository boundary is not available.
The repository check exists to reduce destructive runs in the wrong place. Use the flag only when the current directory is intentional and isolated, because the same prompt can otherwise inspect or modify files from an unintended folder.
Related: How to set the working directory for Codex
Related: How to enable JSON output in Codex
$ codex exec "Return OK." Not inside a trusted directory and --skip-git-repo-check was not specified.
That message confirms the current directory failed the repository safeguard before the task started.
$ codex exec --skip-git-repo-check "Return OK." OK
Skipping the check removes the trusted-directory safeguard, so a prompt started from the wrong folder can inspect or modify unintended files.
$ codex exec --skip-git-repo-check "Run the shell command pwd and return only the command output." /home/user/tmp/codex-scratch
The returned path should match the current working directory, which proves the run started outside a Git working tree.