.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?
There are 3 levels of git config; project, global and system.
Create a project specific config, you have to execute this under the project's directory:
$ git config user.name "John Doe"
Create a global config:
$ git config --global user.name "John Doe"
Create a system config:
$ git config --system user.name "John Doe"
And as you may guess, project overrides global and global overrides system.
Note: Project configs are local to just one particular copy/clone of this particular repo, and need to be reapplied if the repo is recloned clean from the remote. It changes a local file that is not sent to the remote with a commit/push.