As of git version 2.13, git supports conditional configuration includes. In this example we clone Company A's repos in ~/company_a
directory, and Company B's repos in ~/company_b
.
In your .gitconfig
you can put something like this.
[includeIf "gitdir:~/company_a/"]
path = .gitconfig-company_a
[includeIf "gitdir:~/company_b/"]
path = .gitconfig-company_b
Example contents of .gitconfig-company_a
[user]
name = John Smith
email = [email protected]
Example contents of .gitconfig-company_b
[user]
name = John Smith
email = [email protected]