Skip to content
MtrXTools

Host key verification failed.

SSH couldn't confirm the server's identity

Seen in OpenSSH client, git over SSH, CI pipelines, Ansible

SSH refused to connect because the server's host key is unknown or does not match the one in known_hosts, and it could not ask you to confirm.

Common causes

  • The host is not in known_hosts and the session is non-interactive (CI, scripts, git in a container).
  • The server was rebuilt or its IP reused, so its key changed.
  • You answered 'no' at the fingerprint prompt.

How to fix it

  1. Connect once interactively and verify the fingerprint against the provider's published one before accepting.
  2. In CI, add the host key to known_hosts in advance: ssh-keyscan github.com >> ~/.ssh/known_hosts, after checking the fingerprint.
  3. If the key genuinely changed, remove the old entry with ssh-keygen -R hostname.

Got a different message? Paste it into the error explainer.

Related errors

All 31 Dev tools & SSH errors