Skip to content

fatal: Unable to create '.git/index.lock': Permission denied, has full permissions #19190

Open

Description

@doublemover

What version of Codex CLI is running?

0.124.0

What subscription do you have?

Pro

Which model were you using?

gpt-5.5 high

What platform is your computer?

win11 x64

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.

Image

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

Activity

  1. added
    bug
    on Apr 23, 2026
  2. added
    CLI
    windows-os
    sandbox
    on Apr 23, 2026
  3. removed
    CLI
    on Apr 23, 2026
  4. doublemover commented on Apr 23, 2026

    @doublemover
    Author

    Confirming that --yolo works whereas promotion via /permissions does not

  5. joshka commented on Apr 23, 2026

    @joshka

    @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

  6. RoboLagoon commented on Jun 27, 2026

    @RoboLagoon

    It's crazy this bug in codex sandbox is not fixed yet for months @codex fix it!

  7. walter-seethaler commented on Sep 1, 2026

    @walter-seethaler

    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:

    git mv -- <source> <destination>
    fatal: Unable to create 'C:/<workspace>/.git/index.lock': Permission denied
    

    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.

  8. rekafazekas commented on Nov 12, 2026

    @rekafazekas

    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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugsandboxwindows-os

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions