Skip to content

[Bug] Marketplace update fails to find git on Windows: "Command 'git' not found or is in an unsafe location" #42135

Description

@IanVand

Description

claude plugin marketplace update fails on Windows 11 with the error:

Command 'git' not found or is in an unsafe location (current directory)

This happens despite git being available on the system PATH and working correctly from both bash and Node.js (child_process.execSync).

Steps to Reproduce

  1. Install Claude Code on Windows 11 (via npm)
  2. Register one or more plugin marketplaces (GitHub or Git-hosted)
  3. Run claude plugin marketplace update <name>
  4. Observe: CLI detects cache as "stale," attempts to re-clone, and fails

Expected Behavior

Marketplace cache is refreshed successfully using the system git installation.

Actual Behavior

Updating marketplace: cce-claude-code...
Refreshing marketplace cache (timeout: 120s)…
Found stale directory, cleaning up and re-cloning…
Cloning repository (timeout: 120s): https://bitbucket.micron.com/scm/ssedscg/cce_claude_code.git
✘ Failed to update marketplace(s): Failed to refresh marketplace 'cce-claude-code': Failed to clone marketplace repository: Command 'git' not found or is in an unsafe location (current directory)

All 4 registered marketplaces fail with the identical error, which cascades to all plugin updates (plugins can't be found in the stale cache).

Diagnostics

Check Result
which git (Git Bash) /mingw64/bin/git
where git (CMD) C:\Users\...\Git\cmd\git.exe
git clone <url> (bash) Works ✅
node -e "execSync('git --version')" git version 2.45.0.windows.1
claude plugin marketplace update ❌ Fails

The cache directories (~/.claude/plugins/cache/<name>/) exist but contain only plugin subdirectories — no .git directory. This causes the CLI to treat them as stale and attempt a re-clone, which is where the git resolution fails.

Hypothesis

The Claude CLI's git spawning logic may not be using shell: true (or equivalent) when invoking git on Windows, or may be resolving the executable path in a way that doesn't work with Windows PATH conventions. The error message pattern ("not found or is in an unsafe location") suggests the process can't locate the git binary, even though it's accessible from every other context (CMD, bash, Node.js).

Environment

  • OS: Windows 11 Enterprise 10.0.26100
  • Claude Code: 2.1.89
  • Node.js: v24.13.0
  • Git: 2.45.0.windows.1
  • Git install path: C:\Users\<user>\AppData\Local\Programs\Git\
  • Shell: Git Bash (via Claude Code's built-in bash)

Metadata

Metadata

Assignees

No one assigned

    Labels

    staleIssue is inactive

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions