claude-code - 💡(How to fix) Fix [BUG] Worktree isolation fails with "Background full checkout failed: git-crypt-locked" in git-crypt repos [3 comments, 3 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
anthropics/claude-code#58610Fetched 2026-05-14 03:43:49
View on GitHub
Comments
3
Participants
3
Timeline
7
Reactions
0
Timeline (top)
labeled ×4commented ×3

Error Message

  1. Observe the error
  • Other AI coding tools (e.g. Codex) handle this without error, likely by using --no-checkout or by passing -c filter.git-crypt.required=false to git worktree add.

Error Messages/Logs

Root Cause

Actual behavior: git worktree add fails because git invokes the git-crypt smudge filter during checkout, which exits non-zero when the repo is locked, and since filter.git-crypt.required=true by default, the entire checkout aborts.

Code Example

Background full checkout failed: git-crypt-locked

---

conf/**             filter=git-crypt diff=git-crypt
certificates/** filter=git-crypt diff=git-crypt

---

git \
  -c filter.git-crypt.smudge=cat \
  -c filter.git-crypt.clean=cat \
  -c filter.git-crypt.required=false \
  worktree add <path> <branch>

---

Background full checkout failed: git-crypt-locked
RAW_BUFFERClick to expand / collapse

Preflight Checklist

  • I have searched existing issues and this hasn't been reported yet
  • This is a single bug report (please file separate reports for different bugs)
  • I am using the latest version of Claude Code

What's Wrong?

When starting a new Claude Code Desktop session with worktree isolation enabled, the session creation fails with:

Background full checkout failed: git-crypt-locked

This happens in any repository that uses git-crypt to encrypt files via .gitattributes filter rules, e.g.:

conf/**             filter=git-crypt diff=git-crypt
certificates/** filter=git-crypt diff=git-crypt

Steps to reproduce:

  1. Clone a repository that uses git-crypt with files matching .gitattributes filter rules
  2. Open Claude Code Desktop and start a new session with "worktree" isolation checked
  3. Observe the error

Expected behavior: The worktree is created successfully. Encrypted files remain encrypted (locked) in the new worktree — that is acceptable.

Actual behavior: git worktree add fails because git invokes the git-crypt smudge filter during checkout, which exits non-zero when the repo is locked, and since filter.git-crypt.required=true by default, the entire checkout aborts.

Additional context:

  • Running git-crypt unlock before creating the session does not resolve the issue.
  • Other AI coding tools (e.g. Codex) handle this without error, likely by using --no-checkout or by passing -c filter.git-crypt.required=false to git worktree add.

Suggested fix:

When creating a worktree, pass the following git config overrides to bypass the smudge filter:

git \
  -c filter.git-crypt.smudge=cat \
  -c filter.git-crypt.clean=cat \
  -c filter.git-crypt.required=false \
  worktree add <path> <branch>

This allows the checkout to succeed with encrypted files remaining as encrypted bytes — which is the correct behavior for a locked worktree.

Environment:

  • OS: macOS 15.3
  • git-crypt: 0.7.0
  • git: 2.47.0

What Should Happen?

A new worktree should be created.

Error Messages/Logs

Background full checkout failed: git-crypt-locked

Steps to Reproduce

For me, this happens (all the time) when starting a new session as a worktree in a repo that has git-crypt configured after upgrading to the latest version of claude code desktop (Claude 1.7196.0 (2dbd78) 2026-05-12T05:34:40.000Z).

However, colleagues of mine have ran into this on older versions. Some have given up on using worktrees altogether while for others it has magically started working again after a while.

Claude Model

None

Is this a regression?

I don't know

Last Working Version

No response

Claude Code Version

Claude 1.7196.0 (2dbd78) 2026-05-12T05:34:40.000Z

Platform

Anthropic API

Operating System

macOS

Terminal/Shell

Warp

Additional Information

I'm using claude code desktop

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING