diff --git a/images/win/scripts/Installers/Install-Git.ps1 b/images/win/scripts/Installers/Install-Git.ps1 index c7b2c457..6c89250e 100644 --- a/images/win/scripts/Installers/Install-Git.ps1 +++ b/images/win/scripts/Installers/Install-Git.ps1 @@ -36,13 +36,5 @@ Choco-Install -PackageName hub # Disable GCM machine-wide [Environment]::SetEnvironmentVariable("GCM_INTERACTIVE", "Never", [System.EnvironmentVariableTarget]::Machine) -if (Test-IsWin16) { - $env:Path += ";$env:ProgramFiles\Git\usr\bin\" -} - -# Add well-known SSH host keys to ssh_known_hosts -ssh-keyscan -t rsa github.com >> "C:\Program Files\Git\etc\ssh\ssh_known_hosts" -ssh-keyscan -t rsa ssh.dev.azure.com >> "C:\Program Files\Git\etc\ssh\ssh_known_hosts" - Invoke-PesterTests -TestFile "Git" -TestName "Git" Invoke-PesterTests -TestFile "CLI.Tools" -TestName "Hub CLI" diff --git a/images/win/scripts/Installers/Install-Msys2.ps1 b/images/win/scripts/Installers/Install-Msys2.ps1 index 844c071b..dea3b95d 100644 --- a/images/win/scripts/Installers/Install-Msys2.ps1 +++ b/images/win/scripts/Installers/Install-Msys2.ps1 @@ -84,8 +84,15 @@ $pathValue = Get-ItemPropertyValue -Path $regEnvKey -Name 'Path' $pathValue += ";C:\msys64\mingw64\bin;C:\msys64\usr\bin" Set-ItemProperty -Path $regEnvKey -Name 'Path' -Value $pathValue -# Add well-known SSH host keys to ssh_known_hosts +# Add well-known SSH host keys to ssh_known_hosts to Msys2 ssh-keyscan -t rsa github.com >> "C:\msys64\etc\ssh\ssh_known_hosts" ssh-keyscan -t rsa ssh.dev.azure.com >> "C:\msys64\etc\ssh\ssh_known_hosts" +# Add well-known SSH host keys to ssh_known_hosts to Git +if (Test-Path "C:\Program Files\Git\etc\ssh") +{ + ssh-keyscan -t rsa github.com >> "C:\Program Files\Git\etc\ssh\ssh_known_hosts" + ssh-keyscan -t rsa ssh.dev.azure.com >> "C:\Program Files\Git\etc\ssh\ssh_known_hosts" +} + Invoke-PesterTests -TestFile "MSYS2"