Last active
March 31, 2020 05:00
-
-
Save kriscooke/bb437f07bc2c2130557ab5d0bc054b9a to your computer and use it in GitHub Desktop.
Multiple scoped Git identities and configurations (eg: personal and professional emails, multiple keys, etc.). Ideal for developers who use the same computer for multiple work and personal projects. Credit: https://stackoverflow.com/a/49154229
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Example configuration for Company A | |
# This will only be applied for Git operations within ~/code/company-a-work/ | |
# Within this scope, values below will overwrite the corresponding ones in the global .gitconfig | |
# Only mention configs that overwrite or elaborate on the global .gitconfig | |
[user] | |
name = Dr. Betty White | |
email = [email protected] | |
signingkey = yyyyyyyyyyyyyyyy | |
[commit] | |
gpgsign = true # Company A prefers that all commits are signed. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Example configuration for Company B | |
# This will only be applied for Git operations within ~/code/company-b-work/ | |
# Within this scope, values below will overwrite the corresponding ones in the global .gitconfig | |
# Only mention configs that overwrite or elaborate on the global .gitconfig | |
[user] | |
name = Dr. Betty White, CTO | |
email = [email protected] | |
signingkey = zzzzzzzzzzzzzzzz |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Global .gitconfig file located in your home folder. | |
# Put the most private/generalized configuration here as the global defaults. | |
# Configurations that are repeated (for example within an include - introduced in Git 2.x) will be overwritten by successive values. | |
[user] | |
name = Betty White | |
email = [email protected] | |
signingkey = xxxxxxxxxxxxxxxx | |
# Add all other global configuration blocks here, BEFORE the includes. | |
# These configuration files are only included for Git operations within the specified directory, eg: "gitdir/i:path/to/scope/" | |
[includeIf "gitdir/i:~/code/company-a-work/"] | |
# Path to the Company A config file | |
path = .company-a.gitconfig | |
[includeIf "gitdir/i:~/code/company-b-work/"] | |
# Path to the Company B config file | |
path = .company-b.gitconfig |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment