[BUG] `claude --worktree` fails inside a bare repository
Resolved 💬 6 comments Opened Feb 21, 2026 by zzJinux Closed May 27, 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?
As git worktree add works inside any directory under a bare repository, claude --worktree should do so, but it doesn't.
What Should Happen?
Executing claude --worktree creates a worktree _somewhere_.
Error Messages/Logs
Error: Can only use --worktree in a git repository, but WORKING_DIRECTOR is not a git repository
Steps to Reproduce
- Unzip bare-wt-setup.zip
cdto either./bareor./bare/info- 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
Regarding the location for worktrees created from within the bare repository, I think it's a little awkward to create worktrees in $BARE_REPO_DIR/.claude/worktrees/ or $BARE_REPO_DIR/**/.claude/worktrees/. I will create a separate FR issue for it.
This issue has 6 comments on GitHub. Read the full discussion on GitHub ↗