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
This commit is contained in:
24
.claude/scripts/ensure-git-bash.ps1
Normal file
24
.claude/scripts/ensure-git-bash.ps1
Normal file
@@ -0,0 +1,24 @@
|
||||
# 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"
|
||||
}
|
||||
Reference in New Issue
Block a user