How to fix: "WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED" on Mac and Linux
Resolve Using ssh-keygen
Another solution would be to use the ssh-keygen utility to delete the offending key from your known_hosts file, which can be done with the following command:
$ ssh-keygen -R [hostname-or-IP]
So in my example I'd use it like this:
$ ssh-keygen -R ec2-192-168-1-1.compute-1.amazonaws.com
This method is good if you don't want to manually alter the known_hosts file yourself, and the utility is easier to use if you have multiple hostnames and IP addresses to fix. It can also handle hashed hostnames in a known_hosts.old file.