Assuming you already have an ssh key pair for each account and you are using that ssh private key to sign commits, you can manage the different accounts by configuring git to use a different configuration profile based on the directory under which you are cloing the repository.
For each key pair (account) you will create a config file that will apply to all the projects under that account's work directory.
/Users/robandpdx/
|__.gitconfig
|__.gitconfig.work
|__.gitconfig.personal
|__github-work/ # <--- This is where you will clone all your work repositories
|__github-personal/ # <--- This is where you will clone all your personal repositoriesIn your .gitconfig.work config file...
# ~/.gitconfig.work
[user]
name = Your Name
email = [email protected]
signingkey = "~/.ssh/<work_private_key>"
[gpg]
format = "ssh"
[commit]
gpgsign = true
[github]
user = "userhandle_code"
[core]
sshCommand = "ssh -i ~/.ssh/<work_private_key>"In your .gitconfig.personal config file...
# ~/.gitconfig.personal
[user]
name = Your Name
email = [email protected]
signingkey = "~/.ssh/<personal_private_key>"
[gpg]
format = "ssh"
[commit]
gpgsign = true
[github]
user = "userhandle"
[core]
sshCommand = "ssh -i ~/.ssh/<personal_private_key>"Each config file tells git what email and signing key to use for commits, as well as the identity key to use for ssh clones. In your global .gitconfig file we configure git to use each config file based on the directory path you are in...
# ~/.gitconfig
[includeIf "gitdir:~/github-work/"] # for all .git projects under ~/github-work/
path = ~/.gitconfig.work
[includeIf "gitdir:~/github-personal/"] # for all .git projects under ~/github-personal/
path = ~/.gitconfig.personal
[core]
excludesfile = ~/.gitignore # for everywhereWith these configurations in place, you can clone work projects to ~/github-work/ and personal projects to ~/github-personal using the ssh clone url, and commits will be signed with the correct key for that account.