Skip to content

fix(claude): run Git commands that write .git/config outside the sandbox - #121

Merged
0xA3B merged 1 commit into
mainfrom
docs/claude-sandbox-git-config
Nov 11, 2026
Merged

0xA3B merged 1 commit into
mainfrom
docs/claude-sandbox-git-config

Conversation

@0xA3B

@0xA3B 0xA3B commented Nov 11, 2026

Copy link
Copy Markdown
Owner

The Claude Code sandbox blocks writes to .git/config. A Git command that writes it can apply part of its change before it fails with could not lock config file. A sandboxed git switch -c <branch> origin/main creates the branch and rewrites the worktree, fails to record the upstream, and leaves HEAD on the old branch. Recovering from that state took a manual reset and restore.

The user instructions now tell agents to run unsandboxed any Git command that creates a tracking branch or renames, deletes, or sets the upstream of a branch, and to check the branch and status if such a command already ran sandboxed.

The sandbox blocks writes to .git/config. A sandboxed
`git switch -c <branch> origin/main` creates the branch, fails to record its upstream, and
leaves HEAD on the old branch with a partly rewritten worktree.
@0xA3B
0xA3B merged commit e582616 into main Nov 11, 2026
2 checks passed
@0xA3B
0xA3B deleted the docs/claude-sandbox-git-config branch November 11, 2026 02:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant