SSH link encountered error [remote host identification has changed!]

When using vscode to connect to docker development environment, the following error occurred in SSH connection:


At first, I thought that the environment sshd in docker was not started, or the host port was occupied, but after troubleshooting, no problem was found. Baidu later found a solution

Cause of problem:

ssh connection will store the public key in ~/.ssh/known_hosts, when connecting to the same host ssh will check the public key, if the public key is not the same then it will report an error, because
My development environment is in docker, and the host name is the same because of the mapped port, so I deleted the record of the host in the file and reconnected.
It's OK!


Delete the information about the connected hosts in ~/.ssh/known_hosts and you're done!

Similar Posts: