Host Key Verification Failed - GitLab with Visual Studio Code on macOS

Resolved by deleting any/all Known_hosts files in ~/.ssh/ and then executing ssh [email protected] in Terminal and answering "yes" (which re-adds [email protected] to known_hosts after re-creating a new known_hosts file).

I did some messing around in known_hosts which probably caused the problem.


I found that my home profile was loading as "P:\" in git bash (because of my work's IT team...).

Ensure that in git bash you have generated an ssh key using ssh-keygen and that GitLab knows about the key.

If you still have the issue, run ssh -o StrictHostKeyChecking=no <gitlab-host> uptime to make gitlab trusted.