Windows: Bash tool stdout capture broken when using Git Bash via CLAUDE_CODE_SHELL
Description
On Windows 11, when CLAUDE_CODE_SHELL is set to Git Bash (C:/Program Files/Git/bin/bash.exe) in ~/.claude/settings.json, the Bash tool's stdout/stderr capture is broken. Commands execute successfully but Claude Code receives no output and reports Exit code 1.
Reproduction
Settings (~/.claude/settings.json):
{
"env": {
"CLAUDE_CODE_SHELL": "C:/Program Files/Git/bin/bash.exe"
}
}
Steps:
- Set
CLAUDE_CODE_SHELLto Git Bash as shown above - Start a new Claude Code session
- Run any command via the Bash tool, e.g.
echo hello
Expected: Output hello, exit code 0
Actual: Empty output, exit code 1
Key finding
Commands do execute — they just can't pipe output back to Claude Code:
| Command | Result |
|---|---|
| echo hello | Exit code 1, no output |
| echo hello > /tmp/test.txt | Success (file contains hello) |
| pwd > /tmp/test.txt | Success (correct working directory) |
Redirecting to a temp file and reading it back with the Read tool confirms bash is fully functional — the issue is specifically with stdout/stderr pipe capture.
Workaround
Redirect all output to a temp file, then use the Read tool to retrieve it:
echo hello > /tmp/out.txt 2>&1
# then Read /tmp/out.txt
Environment
- Claude Code: 2.1.45
- OS: Windows 11 Pro 10.0.26200 (MINGW64_NT-10.0-26200)
- Git Bash: 5.2.37(1)-release (Git for Windows 2.52.0)
- Node.js: v24.13.0
- Shell path:
C:/Program Files/Git/bin/bash.exe(confirmed exists and works)
Notes
- Without
CLAUDE_CODE_SHELL, Windows resolvesC:\WINDOWS\system32\bash.EXE(WSL) which fails entirely if no WSL distro is installed. SettingCLAUDE_CODE_SHELLto Git Bash was the fix for that — and the shell does launch correctly, it's only the output piping that's broken. - The
CLAUDE_CODE_SHELLenv var is set inside the"env"block of settings.json. This is the documented approach for setting environment variables.
This issue has 6 comments on GitHub. Read the full discussion on GitHub ↗