Configuring SSH Keys for Multiple GitHub Accounts
Posted by Xaneris47@reddit | programming | View on Reddit | 13 comments
Posted by Xaneris47@reddit | programming | View on Reddit | 13 comments
ioneska@reddit
Ok, what about the user.name and user.email, can we swap them as well?
arcanemachined@reddit
I use direnv to set the required environment variables based on which directory I'm in. I have a different directory for my personal stuff vs. my professional stuff.
ioneska@reddit
Ah, just use the .git/config: https://stackoverflow.com/q/9063176
more_exercise@reddit
Specifically, you can put your user.email setting in the ~/.gitconfig_custom file you already wrote. As long as the include section is after the [user] section in your main file, it'll override it :)
ericje@reddit
I would just create a different Linux user for my work stuff.
MrElendig@reddit
Work should be on dedicated hardware
more_exercise@reddit
(which does make it significantly easier to use a different linux user account for work)
sweet_dreams_maybe@reddit
I wonder if Gen Alfa has a word for obnoxiously agreeing.
JoniBro23@reddit
So useful. I did this a long time ago on a contract, to split my personal and work projects
edgmnt_net@reddit
You don't really need multiple SSH keys for this. Unless there's some additional form of separation (separate computers or VMs), it makes little sense.
chadmill3r@reddit
My ssh key is my identification, yes? My ssh username is "git".
What happens if I add my public key to two different GitHub accounts?
PurepointDog@reddit
I mostly just do the heirarchical config thing touched on in the end. Separate folders for each account, and then anything cloned in that dir uses the key for that account.
Wires77@reddit
It also means you can specify different users if your work account is different from your personal account.