Windows: git-bash detection fails when Claude CLI runs inside a git-bash subprocess

Resolved 💬 2 comments Opened Mar 18, 2026 by jay2zxy Closed Apr 15, 2026

Bug Description

On Windows, Claude CLI detects git-bash by finding git executable and deriving ../../bin/bash.exe. This works in cmd/PowerShell but fails when CLI runs inside a git-bash environment (e.g., spawned as a child process from another Claude Code instance).

Root Cause

The detection logic uses a which-style lookup for git:

  • cmd/PowerShell: returns C:\Program Files\Git\cmd\git.exe → derives C:\Program Files\Git\bin\bash.exe
  • git-bash: returns /mingw64/bin/git → derives /mingw64/bin/bash.exe

The Unix-style path cannot be resolved to a valid Windows path for bash.exe.

Reproduction

  1. From Claude Code, spawn a child process that calls claude -p "hello" --output-format json
  2. The child process inherits git-bash environment
  3. CLI fails with: Claude Code on Windows requires git-bash

Workaround

Set CLAUDE_CODE_GIT_BASH_PATH explicitly in the child process environment.

Suggested Fix

When the which git result is a Unix-style path (starts with /), convert it to a Windows path before deriving bash.exe location (e.g., via cygpath -w or resolve through the Windows registry).

View original on GitHub ↗

This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗