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.

Steps to skip Codex git repository checks:

  1. Run codex exec from a directory that is not part of a Git repository.
    $ 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.

  2. Re-run the same task with --skip-git-repo-check.
    $ 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.

  3. Confirm Codex is now allowed to work from the current non-repository directory.
    $ 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.