19 lines
539 B
PowerShell
19 lines
539 B
PowerShell
$ErrorActionPreference = "Stop"
|
|
|
|
$hostName = "git.txyundm.cn"
|
|
$port = "2222"
|
|
$knownHosts = Join-Path $env:USERPROFILE ".ssh\known_hosts"
|
|
|
|
Write-Host "Checking known_hosts entries for $hostName port $port"
|
|
& ssh-keygen -F "[$hostName]:$port"
|
|
if ($LASTEXITCODE -ne 0) {
|
|
Write-Host "WARN: no known_hosts entry for [$hostName]:$port"
|
|
}
|
|
|
|
Write-Host "Attempting read-only SSH handshake."
|
|
& ssh -T -p $port "git@$hostName"
|
|
if ($LASTEXITCODE -ne 0) {
|
|
throw "Gitea SSH handshake failed. Confirm host fingerprint before editing $knownHosts."
|
|
}
|
|
|