Optimizing your experience
Gradient background

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

Clarice Bouwer

Software Engineering Team Lead and Director of Cloudsure

Wednesday, 19 January 2022 · Estimated 1 minute read

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 = clarice@example.com
[includeIf "gitdir:~/path/to/work/directory/"]
    path = ~/path/to/work/directory/.gitconfig
cd ~/
git config user.email # should be your default config email

cd ~/path/to/work/directory
git config user.email # should be your override email