Files
claudetools/.claude/scripts/ensure-git-bash.ps1
Mike Swanson 446a6c1b1c sync: auto-sync from GURU-5070 at 2026-06-02 20:40:54
Author: Mike Swanson
Machine: GURU-5070
Timestamp: 2026-06-02 20:40:54
2026-06-02 20:40:58 -07:00

25 lines
963 B
PowerShell

# ensure-git-bash.ps1
# Ensures that the 'bash' command in the current PowerShell session resolves to
# Git for Windows / MSYS bash (required by ClaudeTools .sh scripts, vault, hooks, etc.)
# instead of the WSL stub in WindowsApps.
#
# Usage:
# . .claude/scripts/ensure-git-bash.ps1
# Or source in profile.
#
# Idempotent and safe.
$gitBin = "C:\Program Files\Git\bin"
$gitUsrBin = "C:\Program Files\Git\usr\bin"
if (Test-Path $gitBin) {
$current = (Get-Command bash -ErrorAction SilentlyContinue).Source
if ($current -notlike '*Git*bin*bash.exe') {
# Remove any existing Git entries first to avoid duplicates, then prepend
$env:Path = "$gitBin;$gitUsrBin;" + ($env:Path -replace [regex]::Escape("$gitBin;"), '' -replace [regex]::Escape("$gitUsrBin;"), '')
Write-Verbose "[ensure-git-bash] Remapped 'bash' to Git/MSYS bash"
}
} else {
Write-Warning "[ensure-git-bash] Git Bash not found at expected path $gitBin"
}