- Create ssh keys for each account
- add them with ssh-add
- create .gitconfigs for each account
[user]
name = MikeDabrowski-Work
email = [email protected]
signingkey = /Users/mike/.ssh/work.pub
[gpg]
format = ssh
[commit]
gpgsign = true
#[core]
# sshCommand = ssh -i ~/.ssh/work
[url "[email protected]"]
insteadOf = [email protected]
- in main gitconfig do ifs
[includeIf "gitdir:/Users/mike/Projects/Work/"]
path=~/.gitconfig-work
- in main ssh config
Host github.com
AddKeysToAgent yes
UseKeychain yes
Host work.github.com
HostName github.com
User git
IdentityFile ~/.ssh/work
...
the commented lines [core] - this is an alternative, if you want to use it, disregard step 5 and [url...] config lines
Test with ssh -vT [email protected]
https://unix.stackexchange.com/a/475853 Start ssh