Git

How to Know the Git Username and Email Saved During Configuration?

Git enables developers to set the variable globally, locally, and system level. If they want to utilize the particular username or email address for a specific Git repository, they can save the Git config username and email fields at the local scope. However, the globally saved username and email address are applied to all available repositories for all users.

This guide will explain:

Let’s check out the above-stated methods one by one!

How to View the Git Global Email and Username Saved During Configuration?

The saved global Git username and email address are associated with Git commit on all repositories on the developer system.

Follow the below-listed steps to know the globally saved username and email address.

Step 1: View Git Global Username

To view the globally saved Git username, run the “git config” command with the “–global” option and “user.name”:

$ git config --global user.name

As you can see, it will display the globally saved username:

Step 2: View Git Global Email

Execute the “git config” command with the “–global” option and “user.email” to know the globally saved Git user email address:

$ git config --global user.email

The globally saved user email will be displayed after executing the above-listed command:

How to View the Git Local Email and Username Saved During Configuration?

The locally saved username and email address are accessible for specific repositories. Check out the following steps to view the saved username and email address.

Step 1: Display Git Local Username

To display the locally saved Git username for users, execute the “git config” command with “user.name”:

$ git config user.name

Step 2: Display Git Local Email

Run the “git config” command to view the saved local user email:

$ git config user.email

How to View the List of All Git Emails and Usernames Saved During Configuration?

If you want to view the list of all Git usernames and emails saved during configuration, the following command can be used:

$ git config --list

As you see, the list of all globally and locally added usernames and emails would display:

That’s all! We have provided the procedure to view the globally and locally saved usernames and user emails during configuration.

Conclusion

To view the globally saved username and user email during configuration, the “$ git config –global user.name” and “$ git config –global user.email” commands are used. On the other hand, if you want to show the locally saved username and user email during the configuration, the “$ git config user.name” and “$ git config user.email” commands are used. The “$ git config –list” command is used to view the list of all Git usernames and emails saved dusting configuration. This guide described the several ways to show the Git username and email saved during configuration.

About the author

Maria Naz

I hold a master's degree in computer science. I am passionate about my work, exploring new technologies, learning programming languages, and I love to share my knowledge with the world.