Skip to content

Commit

Permalink
Search for "git.exe" instead of "git"
Browse files Browse the repository at this point in the history
Passing just "git" to get-command causes the script to fail if you have an alias called "git". For example, I have hub installed (https://github.com/github/hub), which recommends aliasing git=hub. However, after doing this it breaks this posh-git script because `get-command git` returns the new alias which has no path.

Running `get-command git` returns:
CommandType     Name                                               Version    Source
-----------     ----                                               -------    ------
Alias           git -> hub.exe

But `get-command git.exe` returns:
CommandType     Name                                               Version    Source
-----------     ----                                               -------    ------
Application     git.exe                                            2.13.2.1   C:\Program Files\Git\cmd\git.exe
  • Loading branch information
mikesigs authored Jul 10, 2017
1 parent a46032e commit e18c440
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/GitUtils.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -430,7 +430,7 @@ function Find-Pageant() {
# Attempt to guess $program's location. For ssh-agent/ssh-add.
function Find-Ssh($program = 'ssh-agent') {
Write-Verbose "$program not in path. Trying to guess location."
$gitItem = Get-Command git -Erroraction SilentlyContinue | Get-Item
$gitItem = Get-Command git.exe -Erroraction SilentlyContinue | Get-Item
if ($null -eq $gitItem) {
Write-Warning 'git not in path'
return
Expand Down

0 comments on commit e18c440

Please sign in to comment.