It is fairly common that you might be contributing to multiple git repositories which make different git configuration necessary.
Mine and probably the most common case is that I am using different contributor email addresses for my private and work git repositories. You might also want want to have separate global git ignores or other options that differ in multiple repositories.
The way I do it is having one ~/.gitconfig which looks like this:
This defines the defaults for my name, email and a global gitignore. It also tell git to look at another git config for all repositories that are below the ~/devex/ folder. This file is very short for me, as it just changes the email address (~/.gitconfig_devex):
The ~/.gitignore_global is just a normal gitignore file, which excludes all the files the editors or tools I use create. It could for example look like this:
You could use for example https://www.gitignore.io/ to generate this