Skip to content

Allow writable .git/gitdir #12280

Open
Open

Description

@gyf1214

What variant of Codex are you using?

CLI

What feature would you like to see?

This is related to #7071 , see also my comment there.

There are read-only exceptions to a writable root (WritableRoot.read_only_subpaths, see protocol.rs). Currently this is hard-coded with: .git (or gitdir equivalent), .codex and .agents.

It would be nice to make this configurable, especially adding a config to make .git/gitdir writable. Otherwise the agent cannot do any git operations without escalation. It's very annoying to keep approving those operations and make it harder for agents to work autonomously.

The rules system works sometime, but the current pattern matching capability does not deal with shell wrapper very well.

I understand the security concern, but it is less applicable to Codex CLI. In most cases, the project directory is a local git copy of a remote repo. The remote repo has its own security policy to guard against dangerous operations (e.g. protected main, no force push, etc.).

Making this configurable under workspace_write would be the best solution.

Additional information

No response

Activity

  1. added
    enhancement
    on Feb 19, 2026
  2. added
    CLI
    sandbox
    on Feb 19, 2026
  3. github-actions commented on Feb 19, 2026

    @github-actions
    Contributor

    Potential duplicates detected. Please review them and close your issue if it is a duplicate.

    Powered by Codex Action

  4. removed
    CLI
    on Feb 19, 2026
  5. changed the title [-]Allow writable `.git`/`gitdir` in CLI[/-] [+]Allow writable `.git`/`gitdir`[/+] on Feb 19, 2026
  6. samdeane commented on Feb 25, 2026

    @samdeane

    +1 on this change.

    It's not just that it is massively annoying to have to keep approving these operations (although it is!).

    It is also a large security risk, since it trains the user to mindlessly approve. I just accidentally approved an operation on ~/.cache because it was interleaved with some other git changes and I was having to approve every one.

  7. ryush00 commented on Mar 18, 2026

    @ryush00

    I'm using the Graphite CLI, which requires access to the .git directory. Since Codex doesn't currently allow that, I always have to use full-access mode. That feels unnecessarily risky.

  8. gyf1214 commented on Mar 18, 2026

    @gyf1214
    Author

    If you bother build from source (take ~2hrs, I have to do this anyway since the pre-built release does not work on my env)

    I have a fork that simply bypass these "read-only exceptions" to a writable root: https://github.com/gyf1214/codex

    Interestingly I use codex itself to periodically sync with latest release and do build for me.

    Anyway, I really think this should be a configurable feature in the official release.

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

    enhancementsandbox

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions