[Windows] Several fixes for the SSH known_hosts files (#13154)
This commit is contained in:
@@ -46,7 +46,16 @@ if ($LASTEXITCODE -ne 0) {
|
||||
Add-MachinePathItem "C:\Program Files\Git\bin"
|
||||
|
||||
# Add well-known SSH host keys to ssh_known_hosts
|
||||
ssh-keyscan -t rsa,ecdsa,ed25519 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"
|
||||
# Write content to the file used by OpenSSH and the version includes with Git
|
||||
# for Windows
|
||||
$windowsSSHKnownHosts = "C:\ProgramData\ssh\ssh_known_hosts"
|
||||
$gitSSHKnownHosts = "C:\Program Files\Git\etc\ssh\ssh_known_hosts"
|
||||
|
||||
$sshKeyScan = "C:\Program Files\Git\usr\bin\ssh-keyscan"
|
||||
$githubHostKeys = &$sshKeyScan -t rsa,ecdsa,ed25519 github.com
|
||||
$azureHostKeys = &$sshKeyscan -t rsa ssh.dev.azure.com
|
||||
|
||||
Set-Content -Encoding ASCII -Path $windowsSSHKnownHosts, $gitSSHKnownHosts -Value $githubHostKeys
|
||||
Add-Content -Encoding ASCII -Path $windowsSSHKnownHosts, $gitSSHKnownHosts -Value $azureHostKeys
|
||||
|
||||
Invoke-PesterTests -TestFile "Git"
|
||||
|
||||
Reference in New Issue
Block a user