Here I use ~/Development/Github as my workspace, and create two sub folders for
work
andpersonal
Note that if you want to use something different that~/Development/Github
, you must changed the paths in .gitconfig to match
# Contents of ~/.gitconfig
[includeIf "gitdir:~/Development/Github/personal/"]
path = ~/Development/Github/personal/.gitconfig.pers
[includeIf "gitdir:~/Development/Github/work/"]
path = ~/Development/Github/work/.gitconfig.work
[core]
excludesfile = ~/.gitignore
In ~/Development/Github/personal create the file
.gitconfig.pers
# Contents of ~/Development/Github/personal/.gitconfig.pers
[user]
email = [email protected]
name = Herbert West
[github]
user = "the_reanimator"
[core]
sshCommand = "ssh -i ~/.ssh/personal_ssh_key"
In ~/Development/Github/work create the file
.gitconfig.work
# Contents of ~/Development/Github/work/.gitconfig.work
[user]
email = [email protected]
name = Milton Dammers
[github]
user = "undercover_fbi"
[core]
sshCommand = "ssh -i ~/.ssh/work_ssh_key"