Skip to content

Instantly share code, notes, and snippets.

@brndnsmth
Created September 11, 2023 14:11
Show Gist options
  • Save brndnsmth/da30274fdc0d176d78019c99ea4d6298 to your computer and use it in GitHub Desktop.
Save brndnsmth/da30274fdc0d176d78019c99ea4d6298 to your computer and use it in GitHub Desktop.
Use Multiple Git Configs on One Computer

Use Multiple Git Configs on One Computer

Create a global Git config

$HOME/.gitconfig

[includeIf "gitdir:~/personal/"]
  path = ~/.gitconfig-personal
[includeIf "gitdir:~/work/"]
  path = ~/.gitconfig-work

Create individual Git configurations for profiles

$HOME/.gitconfig-work

[user]
 name = work_user
 email = work_email

$HOME/.gitconfig-personal

[user]
 name = personal_user
 email = personal_email
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment