Skip to content

Instantly share code, notes, and snippets.

@sodonnell
Created April 30, 2020 20:05
Show Gist options
  • Select an option

  • Save sodonnell/b20c7abc8230835cd68966e826f567d4 to your computer and use it in GitHub Desktop.

Select an option

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 = "[email protected]"
# file: ~/projects/work/.gitconfig
# my work email address.
[user]
email = "[email protected]"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment