SSH auth fails with “Host key verification failed” despite providing valid keys

时光怂恿深爱的人放手 提交于 2020-12-15 04:54:27

问题


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 git@github.xxxxxx.com:xxxx/xxxxx.git
  displayName: 'clone repo' 

回答1:


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.



来源:https://stackoverflow.com/questions/55422479/ssh-auth-fails-with-host-key-verification-failed-despite-providing-valid-keys

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!