--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

  1. Have a repo with git-crypt initialized and encrypted files
  2. Run claude -w test
  3. Terminal hangs, no TUI renders
  4. Ctrl-C to exit
  5. Observe: branch was created (git branch shows worktree-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 -w should use --no-checkout and then run git-crypt unlock before 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 .
claude

View original on GitHub ↗

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