Git

Git Log Out User From Command Line

Like other tracking tools and software, Git users are required to provide credentials for logging in to the command line. Sometimes developers share their system with other users. In this situation, they want to log out from the Git command line by removing or unsetting their username and email address. For the corresponding purpose, the “git config” command along with the “–global”, “user.name”, and “user.email” options can be utilized.

This guide will talk about the method of logging out from the Git command line.

How to Git Log Out Users From Command Line?

To log out from the Git command line, developers are required to remove their credentials, such as “user.name” and “user.email” by executing the “git config –global –unset user.<name/email>” command.

Follow the below-stated process to perform the above-listed query!

Step 1: Switch to Desired Git Repository

At first, run the “cd” command along with the local repository path and move to it:

$ cd "C:\Users\nazma\Git"

Step 2: Check Configured User Name

Next, to view the command line configured user name, execute the “git config” command along with the “–global” option and “user.name” parameter:

$ git config --global user.name

According to the below-given output, “maria” is configured as a user name:

Step 3: Unset Configured User Name

Now, run the below-listed command to remove the user name from the Git configuration file:

$ git config --global --unset user.name

Here, the “–unset” option is used for deleting the current user name:

Step 4: Verify Remove User Name

Then, ensure the removed user name by running the following command:

$ git config --global user.name

It can be observed that the user name has been successfully removed from the configuration file:

Step 5: View Configured User Email Address

Now, check the saved user email address with the help of the “git config” command:

$ git config --global user.email

Step 6: Unset User Email Address

Next, run the “git config” command “–unset” option to remove the user email address from the Git configuration file:

$ git config --global --unset user.email

Step 7: Ensure Unset Operation

Lastly, verify whether the user email address has been removed or not:

$ git config --global user.email

We have illustrated the process of logging out from the Git command line.

Conclusion

To log out from the Git command line, first, move to the Git folder and check the existing user name. Then, execute the “git config –global –unset user.name” command to remove and verify it. After that, view the current user email address and unset it by running the “git config –global –unset user.email” command. This guide explained the procedure of logging out from the Git command line.

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.