CS Student at the University of Cincinnati

Exec at RevolutionUC and [email protected]. Passionate about building things that people love to use and exploring new technologies. Proud to be a part of the hacker culture and community.

Node.js. JavaScript. C++. Python. Web development.

New Project: git-multi-email

git-multi-email solves the issue of using multiple email addresses in Git on a single machine. It’s a global Git hook for changing your email address as necessary in the Git configuration local to the current repository as an alternative to changing your email address manually per repository.


For an example, consider the following directory structure on your machine:

├── acmatuc
│   ├── archive
│   ├── cpp-language-review
│   └── visualizer
└── astronomerio
├── my-other-project
└── my-project

And the following configuration in your global .gitconfig (found at ~/.gitconfig on your machine):

# ...
name = "Noah"
email = "[email protected]"
astronomerio = [email protected]
acmatuc = [email protected]

Normally, when a commit is made, [email protected] is used as the email address.

Now, with git-multi-email, when a commit is made in a local repository anywhere within a folder named astronomerio, [email protected] will be used as the email alias and set locally for future use in that repository. Similarly, when a commit is made in a local repository anywhere within a folder named acmatuc, [email protected] will be used as the email alias. Otherwise, any commit outside of these directories will use the default [email protected] email address.


Here’s a full demo using the example configuration:


If you were to remove a line from the [emails] section in your ~/.gitconfig file, then any Git repository where the email address changed within that directory will not automatically change back to the default email address (meaning git config user.email will still be the overridden email address).

If you do come across this issue, a quick fix is to set the user.email back to your default email address for that repository (ex: git config user.email "[email protected]").


There are no tests yet, but I’ve considered a solution that uses Docker for tests so that the tests are fully independent of existing Git configurations on a local machine.

That’s it! See the project on on GitHub for the installation guide.

Issues and pull requests are welcome!

Read more posts