3 ms·
you could make two different keys and have a shell script to ssh-add them to the ssh agent to be used. #! /usr/bin/env sh ssh-add ~/.ssh/id_github ssh-add ~/
by weaksauce 6y ago
you could make two different keys and have a shell script to ssh-add them to the ssh agent to be used.
#! /usr/bin/env sh
ssh-add ~/.ssh/id_github
ssh-add ~/.ssh/id_github2
or something like that and then just name it sshadd on the path
or create an alias in your login script
alias sshadd="ssh-add ~/.ssh/id_github && ssh-add ~/.ssh/id_github2"
- jlgaddis 6y agoThere'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".