4 ms·
There's a few ways to try to "workaround" this issue, typically involving multiple "Host" entries in ~/.ssh/config. I haven't actually tried it yet myself, but
by jlgaddis 6y ago
There's a few ways to try to "workaround" this issue, typically involving multiple "Host" entries in ~/.ssh/config.
I haven't actually tried it yet myself, but I think my preference would be to set the "IdentityFile" option to an environment variable (i.e., "${SSH_IDENTITYFILE}") in my ~/.ssh/config file, within an explicit "Host" definition for "github.com").
In my shell initialization files, I'd set $SSH_IDENTITYFILE to either "%d/.ssh/id_ed25519_github_personal" or "%d/.ssh/id_ed25519_github_work" (for example), depending on which I wanted to be the default.
When I wanted to use the other account, all I would need to do would be change which of the keys $SSH_IDENTITYFILE pointed to.
--
Pro-tip: you'll also want to set "ControlPath none" and "IdentitiesOnly yes" for "Host github.com".