.gitconfig is usually stored in the user.home directory.
I use a different identity to work on projects for Company A and something else for Company B (primarily the name / email). How can I have two different Git configurations so that my check-ins don't go with the name / email?
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.
At the end of your .gitconfig file, 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 (the [core] section can be omitted if the global ssh key can be used):
[user]
name = John Smith
email = john.smith@companya.net
[core]
sshCommand = ssh -i ~/.ssh/id_rsa_companya
Example contents of .gitconfig-company_b:
[user]
name = John Smith
email = js@companyb.com
[core]
sshCommand = ssh -i ~/.ssh/id_rsa_companyb