Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Git: Set local user.name and user.email different for each repo

Tags:

git

github

People also ask

Does Git username have to match GitHub?

No, your user.name does not matter.

What is the command to set the user email for the current repository?

Open your terminal and navigate to your git repository. Change Git user name by running: git config --global user.name “Your Name” Change Git user email by running: git config --global user. email “[email protected]


For just one repo:

git config user.name "Your Name Here"
git config user.email [email protected]

For (global) default email (which is configured in your ~/.gitconfig):

git config --global user.name "Your Name Here"
git config --global user.email [email protected]

You can confirm that by printing on the terminal:

  1. Global user:git config --global user.name
  2. Local user: git config user.name

I generally tend to keep diff name/email for my company project and personal project(on github)

Run below command in the git repo where you need to specify the user/email

git config user.name <user-name>
git config user.email <user-email>