When starting using Git, it's crucial to configure username and email properly. This information is used to identify commits and contributions accurately, making collaboration and version history tracking seamless. This tutorial explains how to set Git username and email.
Global Git username and email
The global Git username and email address are linked to commits across all repositories on the system that do not have repository-specific configurations. To set global Git username and email, use the git config
command with the --global
option.
git config --global user.name john
git config --global user.email john@example.com
Afterward, you can verify the setup by executing:
git config user.name
git config user.email
Repository-specific Git username and email
If you need to use a different username or email address for a specific repository, run the git config
command without --global
option inside that repository's directory.
First, navigate to the root directory of the repository:
cd apps/my-project
Set a Git username and email address:
git config user.name john
git config user.email john@example.com
Confirm that the modifications were applied correctly:
git config user.name
git config user.email
Leave a Comment
Cancel reply