excludedCommands in sandbox config does not bypass bwrap filesystem restrictions

Resolved 💬 3 comments Opened Feb 25, 2026 by Master-Rensei 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

  1. Configure settings.json with:
{
  "sandbox": {
    "enabled": true,
    "excludedCommands": ["git"]
  }
}
  1. Set CWD to /home/user (writable by sandbox)
  2. Have a git repo at /opt/project (outside sandbox write allowlist)
  3. 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 excludedCommands setting appears to have no observable effect on bwrap mount behavior

View original on GitHub ↗

This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗