--worktree hangs on repos using git-crypt (smudge filter failure)
Resolved 💬 3 comments Opened Mar 21, 2026 by ankur-continue Closed Apr 18, 2026
Bug Description
claude --worktree (or claude -w) hangs indefinitely on repositories that use git-crypt. The TUI never renders and the process must be killed manually.
Root Cause
The --worktree flag internally runs git worktree add which triggers a checkout. During checkout, git runs the git-crypt smudge filter on encrypted files. Since the new worktree doesn't have git-crypt unlocked, the smudge filter fails:
git-crypt: Error: Unable to open key file - have you unlocked/initialized this repository yet?
error: external filter '"git-crypt" smudge' failed 1
error: external filter '"git-crypt" smudge' failed
fatal: .env/auth_key.pem: smudge filter git-crypt failed
Claude Code doesn't surface this error — it just hangs silently.
Reproduction Steps
- Have a repo with
git-cryptinitialized and encrypted files - Run
claude -w test - Terminal hangs, no TUI renders
Ctrl-Cto exit- Observe: branch was created (
git branchshowsworktree-test) but worktree checkout failed
Manually reproducing the underlying failure:
git worktree add .claude/worktrees/test -b worktree-test
# Fails with git-crypt smudge filter error
Expected Behavior
Either:
claude -wshould use--no-checkoutand then rungit-crypt unlockbefore checkout- Or surface the git error to the user instead of hanging silently
Environment Info
- Platform: macOS (darwin 24.6.0)
- Claude Code version: 2.1.81
- git-crypt is used for encrypting
.env/files
Workaround
Create the worktree manually with --no-checkout, unlock, then run Claude:
git worktree add --no-checkout .claude/worktrees/test -b worktree-test
cd .claude/worktrees/test
git-crypt unlock
git checkout .
claudeThis issue has 3 comments on GitHub. Read the full discussion on GitHub ↗