[BUG] `claude --worktree` hangs forever for a worktree with a bare repository

Status Fixed / completed
Reported on v2.1.50
Maintainer reply None cached
Activity 4 comments · opened Feb 21, 2026 · closed Apr 5, 2026

Preflight Checklist

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

What's Wrong?

claude --worktree hangs forever in a worktree with a bare repository.
It does execute normally in a worktree with a non-bare repository.

What Should Happen?

As the help says:

Create a new git worktree for this session (optionally specify a name)

Error Messages/Logs

_Nothing_

Steps to Reproduce

  1. Unzip bare-wt-setup.zip
  2. cd to worktree-a
  3. Execute claude --worktree

Claude Model

None

Is this a regression?

No, this never worked

Last Working Version

_No response_

Claude Code Version

2.1.50

Platform

Anthropic API

Operating System

macOS

Terminal/Shell

iTerm2

Additional Information

_No response_

View original on GitHub ↗

4 Comments

dan-kez · 6 months ago

I've also had the same trouble, updated git

git --version
git version 2.53.0
claude --version
2.1.62 (Claude Code)

In an empty directory with only a git init the claude --worktree command hangs forever and doesn't launch. I've confirmed no plugins, no mcp added, and sandbox mode isn't on. I've also attempted with claude -w attempt1 --dangerously-skip-permissions to no avail as well

zzJinux · 5 months ago

Not stale

zzJinux · 4 months ago

Now it prints

Error creating worktree: Cannot create a worktree: not in a git repository and no WorktreeCreate hooks are configured. Configure WorktreeCreate/WorktreeRemove hooks in settings.json to use worktree isolation with other VCS systems.
github-actions[bot] · 4 months ago

This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.