Skip to content

Instantly share code, notes, and snippets.

@gturi
Last active January 8, 2024 14:45
Show Gist options
  • Select an option

  • Save gturi/e285ddcff0a27d7ebf3b0c98a6cb4c72 to your computer and use it in GitHub Desktop.

Select an option

Save gturi/e285ddcff0a27d7ebf3b0c98a6cb4c72 to your computer and use it in GitHub Desktop.
Override global git config for specific directories

Override global git config for specific directories

# gitconfig
[user]
  name = username
  email = name.surname@example.com

[includeIf "gitdir:*/private-projects/*"]
  path = ~/.gitconfig-private
[includeIf "gitdir:*/sectret-projects/*"]
  path = ~/.gitconfig-secret
# .gitconfig-private
[user]
  name = private-username
  email = private.name.surname@example.com
# .gitconfig-secret
[user]
  name = secret-username
  email = secret.name.surname@example.com
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment