Host key verification failed Git Origin: Build & delivery OSI layer 7 · Application Last updated 13 Oct 2026

Host key verification failed. fatal: Could not read from remote repository.

SSH doesn’t trust the server’s host key — first connection in a non-interactive environment, or the key changed.

Exact message you may see Host key verification failedREMOTE HOST IDENTIFICATION HAS CHANGED
Seen on: Git

Meaning

CI/Docker builds have an empty known_hosts, and GitHub rotated its RSA host key in March 2023, causing “REMOTE HOST IDENTIFICATION HAS CHANGED” for old entries.

Common causes

  • First SSH connection in CI/Docker (no known_hosts)
  • Stale known_hosts entry after a host key rotation
  • Man-in-the-middle (rare, but verify)

⚡ Quick fix

  1. Add the host key: ssh-keyscan github.com >> ~/.ssh/known_hosts (verify fingerprints)
  2. Remove stale entries: ssh-keygen -R github.com

Detailed fix by platform

Git

  1. ssh-keygen -R github.com && ssh -T git@github.com

How to diagnose

  1. Known hosts — Entry present? Changed?
  2. Recent change — Did it start after a deploy, upgrade, or configuration change? Compare with the last working version.

🔧 Still not fixed?

Many errors look alike. If the steps above didn’t solve it, one of these is probably what you’re facing:

Where this error sits

Origin: Build & delivery. Errors that are often confused with or caused by this one (click to open):

401 — HTTP 401 Unauthorized (HTTP)401AADSTS50076 — Azure AD (Entra ID): AADSTS50076 / AADSTS50079 — multi-factor authentication required (Azure)AADSTS50076AADSTS50126 — AADSTS50126: Error validating credentials due to invalid username or password (Azure)AADSTS50126AADSTS700016 — Azure AD (Entra ID): AADSTS700016 Application not found in the directory (Azure)AADSTS700016auth/invalid-credential — Firebase Auth: auth/invalid-credential (auth/wrong-password, auth/user-not-found, auth/invalid-login-credentials) (Authentication)auth/invalid-credenti…Authentication failed — fatal: Authentication failed for 'https://github.com/x/y.git/' (Git)Authentication failedbad auth : Authentication failed — MongoDB: MongoServerError: bad auth : Authentication failed (code 8000 / 18) (MongoDB)bad auth : Authentica…Bad configuration option: usekeychain — ssh: /Users/me/.ssh/config: line 5: Bad configuration option: usekeychain (macOS)Bad configuration opt…Host key …

Explore the map of this error Full error map →

🧠 Still stuck? Analyze your error

Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.

💬 What worked for others

No tips yet — did something else fix this for you?

Share what worked for you

Tips are checked by an editor before they appear. Links are removed.