Plugin marketplace install fails on Windows when env.PATH is POSIX-style (git-bash format)
Preflight Checklist
- [x] I have searched existing issues and this hasn't been reported yet
- [x] This is a single bug report
- [x] I am using the latest version of Claude Code (2.1.215)
What's Wrong?
On Windows, when settings.json sets env.PATH in MSYS/git-bash POSIX format (colon-separated, e.g. /mingw64/bin:/usr/bin:... — required so that hook commands invoked via bash -c resolve tools correctly, since those spawns are non-login shells and don't recompute PATH from /etc/profile), any plugin/marketplace whose repo requires git clone --recurse-submodules fails:
fatal: 'submodule' appears to be a git command, but we were not able to execute it. Maybe git-submodule is broken?
Root cause (confirmed via GIT_TRACE=1 GIT_TRACE_SETUP=1): git-submodule is a shebang script (#!/bin/sh). Git for Windows' compat layer resolves the shebang interpreter by searching PATH, splitting on ; (Windows convention). When git-bash itself spawns git.exe, MSYS auto-translates the POSIX-style PATH into a real Windows-style env for that non-MSYS child, so it works. When Claude Code (Node process) spawns git.exe directly for its own internal marketplace clone, no such translation happens — the raw POSIX-style string is passed straight through as PATH, so git's sh lookup fails.
What Should Happen?
Claude Code's internal git operations should either (a) normalize PATH to native Windows format before spawning git.exe directly, or (b) route the operation through the detected shell (bash on git-bash systems) so the existing MSYS PATH-translation applies — same as manually running the equivalent git clone from a git-bash terminal, which works fine with the identical env.PATH value.
Repro Steps
- Set
env.PATHin~/.claude/settings.jsonto a git-bash-style POSIX path (colon-separated,/c/...or/mingw64/...entries) — common for users who also rely on hooks running viabash -c(e.g. non-login shell, no/etc/profile). claude plugin marketplace add <owner>/<repo>where the repo/install usesgit clone --recurse-submodulesor triggersgit submodule updateafterward (e.g.JuliusBrussee/caveman).- Clone fails with the error above; trace shows
exec: git-submodule ...immediately followed by the fatal.
Error Messages/Logs
Adding marketplace…✘ Failed to add marketplace: Failed to clone marketplace repository: 14:19:22.836237 exec-cmd.c:266 trace: resolved executable dir: C:/Program Files/Git/mingw64/bin
14:19:22.846389 git.c:476 trace: built-in: git clone --depth 1 --recurse-submodules --shallow-submodules -- git@github.com:JuliusBrussee/caveman.git 'C:\Users\<user>\.claude\plugins\marketplaces\JuliusBrussee-caveman'
Cloning into 'C:\Users\<user>\.claude\plugins\marketplaces\JuliusBrussee-caveman'...
...
14:19:25.125849 run-command.c:674 trace: run_command: git submodule update --require-init --recursive --depth=1 --single-branch
14:19:25.214491 git.c:774 trace: exec: git-submodule update --require-init --recursive --depth=1 --single-branch
fatal: 'submodule' appears to be a git command, but we were not
able to execute it. Maybe git-submodule is broken?
Environment
- Windows 11
- Git for Windows 2.50.1
- Claude Code CLI 2.1.215, launched from Git Bash
defaultShell: bash,env.PATHset to POSIX/git-bash-style path in~/.claude/settings.json