Skip to content

Instantly share code, notes, and snippets.

@sodonnell
Created April 30, 2020 20:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sodonnell/b20c7abc8230835cd68966e826f567d4 to your computer and use it in GitHub Desktop.
Save sodonnell/b20c7abc8230835cd68966e826f567d4 to your computer and use it in GitHub Desktop.
Managing multiple git configurations to separate work/personal identities and other configuration differences.
# file: ~/.gitconfig
# my name is the same in real life and at work.
[user]
name = "Sean O'Donnell"
# All repos/subdirectories in ~/projects/work/ shall respect my work email address/config.
[includeIf "gitdir:~/projects/work/"]
path = ~/projects/work/.gitconfig
# All repos/subdirectories in ~/projects/personal/ shall respect my personal email address/config.
[includeIf "gitdir:~/projects/personal/"]
path = ~/projects/personal/.gitconfig
# file: ~/projects/personal/.gitconfig
# my personal email address.
[user]
email = "myusername@my.personal.domain.com"
# file: ~/projects/work/.gitconfig
# my work email address.
[user]
email = "myusername@my.employer.domain.com"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment