Reputation: 105
In Azure DevOps Pipelines I want to SSH to a private repo with dependencies. I am getting following error:
Host key verification failed. fatal: Could not read from remote repository.
Despite uploading private key to secure files and public key is set in project variables.
see below
steps:
- task: InstallSSHKey@0
inputs:
hostName: $(hostname)
sshPublicKey: $(testkey.pub)
sshPassphrase: $(passphrase)
sshKeySecureFile: testkey
- script: |
git clone [email protected]:xxxx/xxxxx.git
displayName: 'clone repo'
Upvotes: 1
Views: 9565
Reputation: 93
Can't comment on the previous post 'cause I've got less than 50 rep, but what anca was saying is paste from the following into the known_hosts file:
On Windows, this involves:
Upvotes: 1
Reputation: 31
Maybe not the best solution:
Upvotes: 3
Reputation: 137228
Host key verification failed
This doesn't refer to the SSH key you're trying to use to connect. It refers to the server's SSH public key fingerprint. This is the thing you see (and should check) when you first connect to a new machine.
Verifying the host key fingerprint protects against man-in-the-middle attacks, where a malicious third party could sit between you and your target server passing communication back and forth while observing or modifying said communication. The Azure documentation discusses this as well.
Manually SSH to the machine once, check that the fingerprint is what you expect it to be, and accept it. Subsequent connections should work unless the fingerprint changes.
Upvotes: 3