Update remote host key

ssh

>What

ssh-keygen -R <hostname>
ssh-keyscan -H <hostname> >> ~/.ssh/known_hosts

>Why

To clear the error when the remote machine has changed their fingerprint (typically when working with embedded Linux that creates a new key at each boot).

>Reference

From the man pages:

>>ssh-keygen

ssh-keygen -R hostname

Removes all keys belonging to hostname from a known_hosts file. This option is useful to delete hashed hosts (see the -H option above).

>>ssh-keyscan

ssh-keyscan -H

Hash all hostnames and addresses in the output. Hashed names may be used normally by ssh and sshd, but they do not reveal identifying information should the file’s contents be disclosed.