You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fatal: Unable to create '.git/index.lock': Permission denied, has full permissions #19190
What terminal emulator and version are you using (if applicable)?
ps7.x
What issue are you seeing?
Codex is completely unable to use gh or git.
With default permissions, commands that do not require permissions to run do not work. Commands that ask for permissions work.
With full permissions, virtually nothing at all works. After going to great lengths to re-feed it my gh auth token, it's still unable to use git, running in circles about ACLs and sandbox permissions and writing increasingly convoluted scripts to try and simply check files in.
What steps can reproduce the bug?
Use codex
What is the expected behavior?
It can use git
Additional information
"Victory comes from finding opportunities in problems." - Sun Tzu
Reacted by Josh McKinney, Sam Bodanis, shawnhsiehdjit, ultimateu, ttd, Shotaro Nakamura, Elichai Turkel, Frulfump, RoboLagoon, Jason Wu and 4 more
@bolinfest I'm curious about whether this was an intentional result of security hardening or an incidental casualty here - it's hard to tell on this one. It also breaks jj desc which was working fine in 0.122. Can confirm works fine in --yolo
Reproduced again on 2026-09-01 in Codex Desktop on Windows, with the approval UI set to Approve for me and a repository on a normal local NTFS path (no UNC/WSL root involved).
The user requested a routine move of two tracked files. The expected command failed in the standard sandbox:
The exact same git mv command succeeded immediately when rerun with require_escalated.
To rule out an agent-specific mistake, three independent Codex subtasks performed A/B reproductions without modifying project contents:
git status --short succeeded without escalation.
git update-index --refresh or git add --dry-run --refresh -- . failed without escalation with the same .git/index.lock permission error.
The exact same command succeeded with escalation (apart from expected needs update results from an already dirty tree).
A final git status --short was unchanged, confirming that the reproduction itself caused no persistent index or working-tree changes.
This is not the known Windows helper_unknown_error: setup refresh had errors family. The shell starts normally; only the Git index is denied in the managed workspace-write sandbox.
The user impact is worse than a single failed command: Codex receives a generic Git permission error instead of an automatic approval/escalation path. In this case the agent then incorrectly tried Move-Item and apply_patch, wasting substantial time and creating a partial duplicate before eventually rerunning the original git mv with escalation.
A normal local Git index operation inside the writable repository should either work directly or be transparently routed through the configured approval flow. It should not fail as a bare filesystem permission error and rely on the model to infer that it must manually retry the same command outside the sandbox.
Additional reproduction on November 12, 2026 in ChatGPT Work on Windows (PowerShell), with a regular local Git repository on C:. The repository is on main and has no commits yet. git rev-parse --show-toplevel and git --no-optional-locks status --short --branch succeed. git add -- index.html (observed while staging an explicit set of project files including index.html) fails with fatal: Unable to create 'C:/<workspace>/.git/index.lock': Permission denied, blocking the initial local commit. The effective session profile is managed / workspace-write: the project root is writable, .git is explicitly read-only, and sandbox escalation is unavailable. The user reports having selected Full access during earlier troubleshooting. I could verify the effective permissions in the failing session, but could not verify whether Full access was active in the UI for that exact turn. The expected outcome is for a local commit to be possible when the selected permissions allow it, or for the UI to explain any overriding restriction and how to resolve it.
Activity
github-actions commentedon Apr 23, 2026
Potential duplicates detected. Please review them and close your issue if it is a duplicate.
CreateProcessWithLogonW failed: 1326/1909#18620Powered by Codex Action
doublemover commentedon Apr 23, 2026
Confirming that --yolo works whereas promotion via /permissions does not
joshka commentedon Apr 23, 2026
@bolinfest I'm curious about whether this was an intentional result of security hardening or an incidental casualty here - it's hard to tell on this one. It also breaks jj desc which was working fine in 0.122. Can confirm works fine in
--yoloRoboLagoon commentedon Jun 27, 2026
It's crazy this bug in codex sandbox is not fixed yet for months @codex fix it!
walter-seethaler commentedon Sep 1, 2026
Reproduced again on 2026-09-01 in Codex Desktop on Windows, with the approval UI set to Approve for me and a repository on a normal local NTFS path (no UNC/WSL root involved).
The user requested a routine move of two tracked files. The expected command failed in the standard sandbox:
The exact same
git mvcommand succeeded immediately when rerun withrequire_escalated.To rule out an agent-specific mistake, three independent Codex subtasks performed A/B reproductions without modifying project contents:
git status --shortsucceeded without escalation.git update-index --refreshorgit add --dry-run --refresh -- .failed without escalation with the same.git/index.lockpermission error.needs updateresults from an already dirty tree).git status --shortwas unchanged, confirming that the reproduction itself caused no persistent index or working-tree changes.This is not the known Windows
helper_unknown_error: setup refresh had errorsfamily. The shell starts normally; only the Git index is denied in the managed workspace-write sandbox.The user impact is worse than a single failed command: Codex receives a generic Git permission error instead of an automatic approval/escalation path. In this case the agent then incorrectly tried
Move-Itemandapply_patch, wasting substantial time and creating a partial duplicate before eventually rerunning the originalgit mvwith escalation.A normal local Git index operation inside the writable repository should either work directly or be transparently routed through the configured approval flow. It should not fail as a bare filesystem permission error and rely on the model to infer that it must manually retry the same command outside the sandbox.
rekafazekas commentedon Nov 12, 2026
Additional reproduction on November 12, 2026 in ChatGPT Work on Windows (PowerShell), with a regular local Git repository on
C:. The repository is onmainand has no commits yet.git rev-parse --show-toplevelandgit --no-optional-locks status --short --branchsucceed.git add -- index.html(observed while staging an explicit set of project files includingindex.html) fails withfatal: Unable to create 'C:/<workspace>/.git/index.lock': Permission denied, blocking the initial local commit. The effective session profile ismanaged/workspace-write: the project root is writable,.gitis explicitly read-only, and sandbox escalation is unavailable. The user reports having selected Full access during earlier troubleshooting. I could verify the effective permissions in the failing session, but could not verify whether Full access was active in the UI for that exact turn. The expected outcome is for a local commit to be possible when the selected permissions allow it, or for the UI to explain any overriding restriction and how to resolve it.