SSH into local mac, error “WARNING- REMOTE HOST IDENTIFICATION HAS CHANGED!”

SSHing into a local MacOS machine at address "macbook.local", I suddenly got this:

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED! @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY!
Someone could be eavesdropping on you right now (man-in-the-middle attack)!
It is also possible that a host key has just been changed.
The fingerprint for the ED25519 key sent by the remote host is
SHA256:oKCEu3pDdq7xBhSPZwOzR2q0eWTvfphtvn3D4Bjz8v4.
Please contact your system administrator.
Add correct host key in /Users/username/.ssh/known_hosts to get rid of this message.
Offending ECDSA key in /Users/username/.ssh/known_hosts:147
Host key for macbook.local has changed and you have requested strict checking.
Host key verification failed.

The solution was to run ssh-keygen -R macbook.local then try the ssh again. Then it asked me whether or not to accept the key, instead of rejecting it:

$ ssh username@macbook.local
The authenticity of host 'macbook.local (fe80::1890:fd32:c304:69cd%en0)' can't be established.
ED25519 key fingerprint is SHA256:oKCEu3pDdq7xBhSPZwOzR2q0eWTvfphtvn3D4Bjz8v4.
This key is not known by any other names
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
Warning: Permanently added 'macbook.local' (ED25519) to the list of known hosts.
(username@macbook.local) Password:
Last login: Sat Feb 14 19:33:39 2026
username@macbook ~ %

See all movie reviews...