SSH, Actually 100% signal, 0% noise.

Multiple Accounts, One Service

scenario
depth 2/3 − deeper + surface

You have two GitHub accounts—personal and work—with one SSH key registered to each. Same hostname, same git username; SSH config matches on Host, so a single Host github.com block can only name one key. Whichever key it names, the other account breaks. You can't win—until you use host aliases.

Why it happens: when you run git clone [email protected]:work-org/project.git, SSH looks for a Host block matching github.com, finds one, and uses whatever key that block specifies. It does not know or care which GitHub account you mean. The only difference between your accounts is the key—but you've given SSH the same Host for both.

The solution—one alias per account, both pointing at the real hostname:

Host github-personal
    HostName github.com
    IdentityFile ~/.ssh/github_personal
    IdentitiesOnly yes

Host github-work
    HostName github.com
    IdentityFile ~/.ssh/github_work
    IdentitiesOnly yes

What changes in practice—clone URLs use the alias instead of github.com:

git clone git@github-personal:my-user/my-repo.git
git clone git@github-work:work-org/project.git

For repos you already have, update the remote:

git remote set-url origin git@github-personal:my-user/my-repo.git
git remote -v   # check the current remote

Test both identities:

ssh -T git@github-personal
# → Hi personal-user! You've been authenticated...

ssh -T git@github-work
# → Hi work-user! You've been authenticated...

If both return the correct username, the configuration is working.