"Too many authentication errors"

This one's a "note to self".

Every so often I'll be playing with a cluster of VMs on my laptop and get a "Too many authentication errors" when I try to connect from one to another via passwordless ssh:

local_user@local_vm$ ssh remote_user@remote_vm

I spend ages each time trying to remember/look up/figure out the solution, so I thought I'd better write it down.

The fix that works for me is to issue the following command on the remote machine, to forget previously loaded identities:

remote_user@remote_vm$ ssh-add -D

All identities removed.

(You can use -d instead of -D to forget just the primary identity)

Please note that this isn't intended to be a tutorial on how to manage identities in a production environment!