Claude Code
Ready Git probe / CLAUDE_CODE_GIT_BASH_PATH Windows Difficulty Easy
Works with no config by default: the installer drops a bash launcher right on the probe path; an env var can pin it explicitly.
settings.json · pin it explicitly (not needed by default; only when the probe misses)
{
"env": {
"CLAUDE_CODE_GIT_BASH_PATH": "C:\\Users\\<你>\\AppData\\Local\\Programs\\Niubash\\winuxcmd\\bin\\bash.exe"
}
} Steps
- Installing niubash is the whole job: the installer places a bash.exe launcher in C:\Program Files\Git\bin, exactly hitting Claude Code's first probe
- If the probe misses, write the env block above into the Claude Code settings.json
Verify
echo "SHELL=$SHELL"; uname -s — expect uname -s to start with MSYS_NT-
Rollback
Remove env.CLAUDE_CODE_GIT_BASH_PATH from settings.json Notes & pitfalls
- The variable only accepts paths whose file name is bash.exe / sh.exe / bash / sh — pointing it at niu.exe is silently ignored (that is why it targets the launcher, not niu itself)
- Since v2.1.120, a missing Git Bash falls back to PowerShell (instead of Linux)
- Historical pitfall: hopping through the launcher used to flash a console window per command (niubash#379); fixed in rubash#668 — upgrade to a build containing the fix and it is gone
Sources
agents.md#claude-codeniubash#398(Program Files 槽位刻意不占位)niubash#377niubash#379rubash#668- agents.md (the complete probe-mechanism document) ↗
Chinese edition of this page: /agents/claude-code/