Visual Studio Code can’t connect the host for ‘Host key verification failed’

In my story , Be careful of the ‘id_rsa’ file, when your .ssh directory has the ‘id_rsa’ file that your IdentityFile config will not available. that really takes me a lot of time to realize it, because when the output for failed all we can know is ‘Host key verification failed’ and can’t see which key file is actually use(I think that quietly no sense).

as we all know when we want to use vscode to connect to a new server, we need to add your new host in the .ssh/config file :

Host hostname(whatever name you want)

HostName ip_addr

IdentityFile .ssh/key_filename

User username

But be careful: when the .ssh directory has id_rsa file, the IdentityFile your config is not available, and always use the default file id_rsa as your key file. I fall into this trap and waste much time on it.


Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store