[BUG] --worktree flag silently fails with Bitbucket (non-GitHub) remotes
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?
The --worktree (-w) flag does nothing when the repository's remote is hosted on Bitbucket (or presumably any non-GitHub host). Claude opens normally in the current directory with no worktree created and no error message shown to the user.
What Should Happen?
A worktree should be created at .claude/worktrees/<name>/ and Claude should open in it, regardless of the git remote host. The docs make no mention of a GitHub-only restriction.
Error Messages/Logs
No error is shown in the UI. Debug logs (`CLAUDE_CODE_DEBUG_LOGS_DIR`) reveal the root cause:
Git remote URL: git@bitbucket.org:org/repo.git
Could not parse repository from: git@bitbucket.org:org/repo.git
Parsed repository: null from URL: git@bitbucket.org:org/repo.git
Not in a GitHub repository, skipping path mapping update
After this, there is no further mention of worktree creation anywhere in the logs — the `--worktree` flag appears to be silently abandoned.
Steps to Reproduce
- Have a git repository whose remote is on Bitbucket (e.g.
git@bitbucket.org:org/repo.git) - Run
claude --worktree my-featurefrom the repo root - Claude opens normally — no worktree is created, no error is shown
- Run
git worktree listto confirm no worktree was created - Check
.claude/worktrees/— directory is empty or doesn't exist
Claude Model
Sonnet (default)
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
Terminal.app (macOS)
Additional Information
The --worktree flag was added in v2.1.49. The URL parsing logic that gatekeeps worktree creation appears to be GitHub-specific and causes the feature to silently no-op for Bitbucket, GitLab, and potentially any other non-GitHub remote. A non-GitHub remote should not prevent worktree creation — the two are entirely unrelated operations. At minimum, a clear error message should be shown if a non-GitHub remote is genuinely required.
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗