How to use a different email address in Git in sub directories

Estimated 1 minute read · Wednesday, 19 January 2022

I want to override my personal email address I use for Git with my work email address in my work directory without manually changing it each time.

# any customization/overrides can be added here
        name = Clarice Bouwer
        email =
[includeIf "gitdir:~/path/to/work/directory/"]
    path = ~/path/to/work/directory/.gitconfig
cd ~/
git config # should be your default config email

cd ~/path/to/work/directory
git config # should be your override email
We use essential cookies to make our site work. With your consent, we may also use non-essential cookies to improve user experience and analyze website traffic. By clicking 'Accept', you agree to our website's cookie use as described in our Privacy Policy.