git-bash-on-windowslisted
Install: claude install-skill dexteon/agent-skills
# Git Bash on Windows: survival guide for coding agents
You are an agent running shell commands on Windows. Your "bash" is Git Bash (MSYS2),
a POSIX layer bolted onto Windows. Most traps here do not throw an error. They let a
command look like it succeeded while it quietly did the wrong thing, and your "done"
report is then wrong. This guide names each trap with its symptom, its cause, and a
copy-pasteable fix. Mark every command block with its shell (```bash or ```powershell).
Read the Top traps table before your first command on a Windows host.
## Top traps (read first)
| # | Symptom | Cause | Fix |
|---|---------|-------|-----|
| 1 | An arg like `/c/foo` or `/FI` turns into `C:/foo` on the way to a program | MSYS rewrites anything that looks like a POSIX path | Prefix `MSYS_NO_PATHCONV=1`, or double the slash (`//FI`) |
| 2 | `cd /d somedir` fails with `cd: too many arguments` | `/d` is a cmd.exe flag, not a bash one | Use `git -C DIR`, `make -C DIR`, `npm --prefix DIR`; or `cd DIR` with no `/d` |
| 3 | A CLI arg like `--out C:\logs\x.db` makes a weirdly named relative file | Bash eats the backslashes before the program sees them | Pass forward-slash paths: `--out C:/logs/x.db`, then confirm the file exists |
| 4 | A pipeline "fails" (exit 1) though the real work succeeded | Exit code is the LAST stage; `grep -c` with 0 matches is exit 1 | Check the real stage's result; do not let `|| echo` mask failures |
| 5 | A Python heredoc writes a corrupt file from `"C:\\foo"` |