For most git users, different git configs for different repos are desired. Here comes a way to get it done once and for ever.
$ cd ~ && tree -La 2
.
├── .gitconfig
└── company
└── .gitconfigFor example, for the user profile case:
-
.gitconfig: git config under user scope[user] name = YourUsername email = YourUsername@email.com # Keep these lines at the bottom of the file [includeIf "gitdir:~/company/"] path = ~/company/.gitconfig -
company/.gitconfig: git config for specific repos undercompanydirectory[user] name = YourUsernameForCompany email = YourEmailForCompany@company.com
To check if it works:
$ cd ~/company/any_repo && git config user.name
YourUsernameForCompany
$ git config user.email
YourEmailForCompany@company.com