How to configure a global Git username and email

Arif Billah Babu

         

  git



Image not found!!

To configure a global Git username and email, you can use the following commands in your terminal or command prompt. Open your terminal and type:

  1. Set your global username:
bash
git config --global user.name "Your Name"

Replace "Your Name" with your actual name.

  1. Set your global email address:
bash
git config --global user.email "your.email@example.com"

Replace "your.email@example.com" with your actual email address.

This information will be associated with your commits and will be visible in the commit history. The --global flag ensures that this configuration is applied globally to all your Git repositories.

You can verify your global configuration by running the following command:

bash
git config --global --get-regexp "^user\."

This will display your configured global username and email.

Remember that these configurations are optional, and you can set different usernames and emails for specific repositories if needed. In a particular repository, you can use the same commands without the --global flag to set a local configuration specific to that repository. The local configuration takes precedence over the global one within that repository.