Set Git Repository-Specific Email and Username

Markus Winkler at Pexels

Quite often, I end up working in multiple git repositories, with different credentials, on the same machine. While this usually doesn’t cause much of a problem, your git commit history may not match the account that you are using. This is especially obvious in Github, where your username/email are used to display the name + icon of the person committing to a repository. The solution for this is to set a repository-specific email and username.

Open up your terminal within the local git repository folder and type the following commands:

git config user.name "USERNAME"
git config user.email "MYEMAIL@EMAIL.COM"

Once you have run these commands, add + commit changes, and the commit will contain your entered email and username. Please note that this does not revert the information in older commits, so this is best done early on within a project.