.git is mounted read-only even though Codex is configured for workspace-write
Open 💬 9 comments Opened Mar 23, 2026 by dalum
💡 Likely answer: A maintainer (github-actions[bot], contributor)
responded on this thread — see the highlighted reply below.
What version of Codex CLI is running?
v0.116.0 (but the issue started on v0.115.0)
What subscription do you have?
Business
Which model were you using?
gpt-5.4, gpt-5.4-mini
What platform is your computer?
Linux 6.18.12-1-MANJARO x86_64 unknown
What terminal emulator and version are you using (if applicable)?
Terminator
What issue are you seeing?
In my Codex session, the workspace is configured with sandbox_mode = "workspace-write" and the repo path is included in writable_roots, but attempts to write into .git fail with Read-only file system.
Evidence
~/.codex/config.tomlshows:sandbox_mode = "workspace-write"- the repo path is included under
[sandbox_workspace_write].writable_roots - Running this inside the workspace (when run by Codex) fails:
touch .git/codex_write_test
touch: cannot touch '.git/codex_write_test': Read-only file system
This prevents:
- creating branches
- committing changes
- any operation that writes repo metadata
What steps can reproduce the bug?
- Open a Codex session in a git repository.
- Ensure the session is configured with:
sandbox_mode = "workspace-write"- the repository path included in
writable_roots
- Ask Codex to run:
```bash
touch .git/codex_write_test
- Observe the error:
touch: cannot touch '.git/codex_write_test': Read-only file system
What is the expected behavior?
If the workspace is configured for workspace-write, .git inside the repo should also be writable so normal git operations work:
- git commit
- git branch
- updates to the index and refs
Additional information
- This appears to be a sandbox mount or policy issue, not a Unix permissions issue.
- .git ownership and permissions look normal; the failure is specifically Read-only file system.
- The issue was not present in version v0.114.0 or before and the only reliable workaround I have found so far is to downgrade to this version
9 Comments
Potential duplicates detected. Please review them and close your issue if it is a duplicate.
Powered by Codex Action
likely has something to do with the bwrap migration,
you can run ``
codex features enable use_legacy_landlock`` to switch to the old behavior.source: https://github.com/openai/codex/issues/14936#issuecomment-4101842750
Thanks for the report! This just brings the linux sandbox behavior in line with macOS where writes to
.gitare not allowed. This was a missing feature on Landlock which is why it was working before.Before #13453, the bubblewrap path was accidentally not re-applying the default
.git/ resolvedgitdirread-only carveout after writable roots, so git metadata writes worked inworkspace-writeon Linux by accident. #13453 fixed bwrap to consume the split filesystem policy directly and re-apply those read-only subpaths.Thanks for the response! However, it raises the question: "why should writes to
.git_not_ be allowed inworkspace-writemode?" And if not, could an elevated mode be added that is not quite "yolo", but which allows writes to.git? It is a quite common workflow in my organisation to have agents perform git actions.yea this basically means that codex cannot perform
git commitwithin the sandbox. It's common in my workflow to have codex create a git commit and then create a pull request / merge request.I think one workaround is to add
to writable_roots but it's a little annoying to do so when you have worktrees since you need to do it once for each worktree. Maybe we can have a configuration entry to allow git operations within the sandbox that binds
.gitas readwrite instead of read-only?I was redirected here from #16794
I modified my app's config.toml to try to use the workaround:
The agent still can't write to .git:
I got the same problem on ubuntu 24.04 with the latest codex version (0.128.0).
As codex is good at debugging i let it do the digging :)
Here is what codex came up with and it worked for me (~/.codex/config.toml changes):
But please fix that, doesn't make sense that
.gitis read only in the sandboxEven codex cli is annoyed by this. This is part of my transcript:
Confirming on macOS Codex CLI (
workspace-write). Reproduced today:touch tool/.git/test_writefails the same way ("Operation not permitted"), buttouch tool/test_writesucceeds — so the restriction is on.git/specifically, not the workspace root.Tried both with and without
sandbox_permissions: require_escalated; both fail with the same error.require_escalatedbypasses network/UI restrictions but not the hardcoded.gitread-only carveout.My
~/.codex/config.tomluses a customproject-editprofile that extends:workspace, enables network, and scopes filesystem rules back to:workspace_rootswith the standard**/.envdeny. Full config:Even with that,
git add/git commitstill fail with the same.git/index.lock: Operation not permittederror — the.gitread-only carveout wins.Gotcha on the fix: the policy engine rejects
**/.gitfor write:So the working lines are either of these (the
.git/**form also covers files inside.git):Without one of those, the default
.gitread-only carveout wins andgit add/git commitis impossible inside the sandbox.It would be much nicer if Codex could stage/commit inside the workspace by default in
workspace-write. Git metadata writes are core workflow operations, not exceptional ones, and the explicit escalation model already covers the riskier surface (push, force-push, etc.).