Note

Codex Windows Git Sandbox Notes

May 28, 2026 ยท growing

codexwindowsgitsandbox

This note records a practical Codex CLI issue on Windows: GitHub SSH authentication can work, while git pull still fails inside the Codex sandbox because Git for Windows starts MSYS2/Git Bash.

Symptom

Inside the Codex Windows sandbox:

& "C:\Program Files\Git\usr\bin\sh.exe" -lc "echo ok"

fails with:

fatal error - couldn't create signal pipe, Win32 error 5

At the same time:

ssh -T git@github.com

can still authenticate successfully.

Finding

The root issue is not the GitHub SSH key. It is not primarily the HTTP_PROXY / HTTPS_PROXY settings either. The sharper repro is that Git Bash itself cannot initialize inside the Windows sandbox, while the same command works outside the sandbox.

HTTPS Git commands may still work inside the sandbox because they avoid the SSH path that triggers Git for Windows shell behavior. SSH remotes are more likely to hit the MSYS2/Git Bash failure.

.git Metadata Writes

Another Windows sandbox failure mode is direct .git metadata writes. A sandboxed clone can create a partial .git directory, then fail while updating HEAD.lock:

warning: unable to unlink 'D:/agent/<repo>/.git/HEAD.lock': Invalid argument
error: unable to write symref for HEAD: Permission denied

The minimal repro does not require GitHub or a live Git process: creating D:\agent\acl-probe\.git\hooks inside the sandbox and then deleting it can fail with Access to the path 'hooks' is denied. Running the same cleanup and git clone outside the sandbox succeeds.

Operational rule: treat Git commands that create or modify .git as sandbox-escape commands on this Windows machine. Use approval/escalation for git clone, git pull, git checkout / git switch, git add, git commit, and cleanup of failed clone directories that contain .git.

Working Pull Pattern

When SSH Git operations are needed from Codex on Windows, run them outside the sandbox and prefer native Windows OpenSSH:

$env:GIT_SSH_COMMAND = 'C:/Windows/System32/OpenSSH/ssh.exe -F none -i C:/Users/Inna/.ssh/github_id_rsa -o IdentitiesOnly=yes -o StrictHostKeyChecking=accept-new'
$env:ALL_PROXY = ''
$env:GIT_HTTP_PROXY = ''
$env:GIT_HTTPS_PROXY = ''
git pull --ff-only

This keeps GitHub auth on SSH keys and avoids reading long-lived GitHub tokens into the session.

openai/codex#23141 is a different Windows/Git Bash problem, but it points in the same operational direction: avoid letting Windows Codex workflows depend on MSYS2 path and shell behavior when a native Windows executable is available.

Relevant link:

Personal Rule

For this machine: