This article will be a quick tips if you’re using multiple git config inside one local machine. For example if you’re working on both Gitlab/Bitbucket/Github with different email/username/gpgsign, or you’re working on your personal and work git account on the same machine.
Setup Gitconfig Directory
This directory name would be anything, but for the sake of naming convention let’s call it
Setup Each Gitconfig
Now you have create the directory, let’s say you want to set your
Setup Personal Gitconfig
--file=personal flag, the gitconfig will be configured inside
Now let’s do the same with your work account.
Setup Work Gitconfig
Now you have set both your account. Then, how to switch between each gitconfig?
Let’s say you put all your company’s git directory at
~/Works and yours at
~/Personals. You can switch easily by configure the global gitconfig using
Now everytime you’re inside
~/Works/ you are using the
~/.gitconfig.d/work, and when you’re inside
~/Personals/ you are using the
You can check whether the gitconfig load properly or not by simply executing
git config user.email command and see what email is showing up.
Thank you for reading!