excludedCommands in sandbox config does not bypass bwrap filesystem restrictions
Status Fixed / completed
Maintainer reply None cached
Workaround ✓ Mentioned in description ↑
Activity 3 comments · opened Feb 25, 2026 · closed Feb 25, 2026
Description
excludedCommands: ["git"] in settings.json sandbox config does not bypass bwrap filesystem write restrictions. Git commands that need to write (e.g., git add, git commit) fail with "Read-only file system" when the repo is outside the sandbox's writable paths.
Environment
- Claude Code v2.1.56
- bwrap 0.9.0
- Ubuntu 24.04 (WSL2)
- Settings:
sandbox.enabled: true,sandbox.excludedCommands: ["git"]
Steps to Reproduce
- Configure
settings.jsonwith:
{
"sandbox": {
"enabled": true,
"excludedCommands": ["git"]
}
}
- Set CWD to
/home/user(writable by sandbox) - Have a git repo at
/opt/project(outside sandbox write allowlist) - Run:
git -C /opt/project add file.txt
Expected Behavior
git should run outside the bwrap sandbox (per excludedCommands docs), allowing writes to /opt/project/.git/.
Actual Behavior
fatal: Unable to create '/opt/project/.git/index.lock': Read-only file system
Even git via a shell script at a writable temp path fails — the sandbox applies filesystem restrictions regardless of excludedCommands.
Workaround
User must run git commands manually outside Claude Code, or via a script in a separate terminal.
Notes
- Read-only git commands (
git status,git log,git diff) work fine since they don't write to.git/ - The
excludedCommandssetting appears to have no observable effect on bwrap mount behavior
3 Comments
Found 3 possible duplicate issues:
This issue will be automatically closed as a duplicate in 3 days.
🤖 Generated with Claude Code
Closing as duplicate of #17727 — the root cause is the same: bwrap on Linux doesn't properly handle excludedCommands or filesystem write permissions. Upvoted the original.
This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.