How to manage multiple git “emails”

Narendra Sisodiya
1 min readMay 28, 2019

I have 2 kinds of git repos.

  1. Work-related code where I use my work email Id while git commits.
  2. Open Source code where I use my personal email id while git commits.

A lot of times, email mismatch happen. there is an easy solution for it.

The root cause of this mismatch is the “global” flag

git config --global user.email "EMAIL ID"

setting up “per repo” or “repo specific” user name and email is the solution.

Or you can directly edit the git config file.

.git/config

It is quite easy to set up a “pre-commit” hook to verify If email is not specified.

--

--