A scratch directory can hold a one-off task without needing Git history. Codex exec normally refuses to run there, but its repository-check override allows an intentional task outside a repository.
The bypass affects only the non-interactive repository guard for one run. It does not authenticate the CLI, widen the sandbox, or mark a directory as trusted for project-scoped .codex/config.toml layers. Normal project work belongs in the intended repository, where the guard can catch a command launched from the wrong folder.
You need an installed Codex CLI configured with a working model provider and an existing scratch directory. Files read by Codex can reach that provider, so the directory should contain only data you can share with it.
Steps to skip Codex git repository checks:
- Select the existing directory for the one-off task.
$ cd /path/to/scratch
The placeholder /path/to/scratch stands for your existing directory where you intentionally want to work outside Git. For a task that belongs to a repository, the project directory is the appropriate location instead.
Related: How to set the working directory for Codex - Confirm that the shell is in the intended scratch directory.
$ pwd /path/to/scratch
The output must identify the directory you selected before the repository safeguard is bypassed.
- Run a harmless directory question with the repository check disabled for this invocation.
$ codex exec --skip-git-repo-check "What directory are you working in?" ##### snipped ##### The current working directory is `/path/to/scratch`. No additional tools are needed as this information is already provided in the environment context.
The flag applies only to this invocation. Progress appears in the terminal before the final answer. The sandbox and project trust settings remain unchanged.
- Check that Codex's final answer names the directory printed by pwd.
A reply naming the scratch directory shows that the task ran outside a repository. A repository-guard error, authentication error, or model-provider error means the task did not complete.