sandbox.excludedCommands not working for git SSH operations
Resolved 💬 3 comments Opened Oct 31, 2025 by gsong Closed Nov 4, 2025
Description
The sandbox.excludedCommands setting does not appear to exclude git commands from sandboxing, preventing SSH authentication for git push/pull operations.
Configuration
In settings.json:
{
"sandbox": {
"enabled": true,
"excludedCommands": ["git"],
"network": {
"allowUnixSockets": ["/private/tmp/com.apple.launchd.*/Listeners"]
}
}
}
Expected Behavior
Based on the sandboxing documentation, commands listed in excludedCommands should "bypass the sandbox entirely" and "run directly in your environment."
Git commands should have access to SSH keys and the SSH agent socket for authentication.
Actual Behavior
Git commands still run sandboxed and cannot access the SSH agent:
$ git push --force-with-lease
Warning: Permanently added 'github.com' (ED25519) to the list of known hosts.
git@github.com: Permission denied (publickey).
fatal: Could not read from remote repository.
Even ssh-add -l fails:
Error connecting to agent: Operation not permitted
Workaround
Using dangerouslyDisableSandbox: true on individual Bash tool calls works correctly.
Environment
- OS: macOS (Darwin 24.6.0)
- SSH_AUTH_SOCK:
/private/tmp/com.apple.launchd.CbSQMJSe88/Listeners(verified to exist) - Git works from terminal: Yes, SSH authentication works fine outside Claude Code
Steps to Reproduce
- Configure
sandbox.excludedCommands: ["git"]in settings.json - Restart Claude Code
- Attempt
git pushto a repository requiring SSH authentication - Observe permission denied error
Additional Notes
Tested with both:
sandbox.enabled: trueexplicitly setsandbox.enabledomitted (default behavior)
Both configurations exhibit the same issue.
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗