IdentitiesOnly
definitionAn SSH config option that forces SSH to use only the identities explicitly listed—the keys named in IdentityFile—instead of trying every key you have.
Without it, SSH offers your keys one after another until something works. Servers count each offered key as an authentication attempt, and once you own a handful of keys you start hitting "too many authentication failures" before the right key is ever tried.
Pair it with IdentityFile in any block where the key matters:
Host github.com
IdentityFile ~/.ssh/id_github_yk
IdentitiesOnly yes
Best practice—set it globally, so every connection presents only what you deliberately configured:
Host *
IdentitiesOnly yes
The payoff: the correct key is always used, and fewer authentication failures. If a connection still picks a key you didn't expect, ssh -G hostname shows which config rules matched and what SSH actually resolved.