.gitconfig is usually stored in the user.home directory.
I use a different identity to work on projects for Company A and something else fo
You can customize a project's Git config by changing the repository specific configuration file (i.e. /path/to/repo/.git/config). BTW, git config writes to this file by default:
cd /path/to/repo
git config user.name 'John Doe' # sets user.name locally for the repo
I prefer to create separate profiles for different projects (e.g. in ~/.gitconfig.d/) and then include them in the repository's config file:
cd /path/to/repo
git config include.path '~/.gitconfig.d/myproject.conf'
This works well if you need to use the same set of options in multiple repos that belong to a single project. You can also set up shell aliases or a custom Git command to manipulate the profiles.