Git

How to Change my Git Username in Terminal?

Git is a popular distributive DevOps version control tool for project management. It manages the source code of projects. More specifically, Git users configure their username and email address on Git to better manage their projects and for security reasons. However, users may want to transfer project access to another user or change their username.

This write-up will demonstrate the method to change the Git username in the terminal.

How to Change Git Username in the Terminal?

Git users can change the Git username globally on Git and Git local repository. We have listed down the method to change the Git username globally and of Git local repository in the Git terminal:

Let’s check out each method individually!

Method 1: Change Git Username Globally in Terminal

To change the Git username globally, check out the below-provided steps.

Step 1: Launch Git Terminal

First, launch the “Git Bash” Git terminal from the Start menu:

Step 2: Check Git Username

Utilize the below-provided command to view the current username:

$ git config user.name

Step 3: Change Username

To change the username, run the “git config” command. The option “–global” is utilized to set the username globally in Git:

$ git config --global user.name "Jenny"

Check the username again to verify if the new username was successfully changed:

$ git config user.name

Here, you can see we have successfully changed the username to “Jenny”:

Method 2: Change Git Username of Local Repository in Terminal

To change the Git username of the local Git repository in Git Terminal, follow the provided instructions.

Step 1: Open Git Repository

Open the Git repository by utilizing the “cd” command:

$ cd "C:\Git"

Step 2: Check Repository Username

Check the current username in the Git local repository:

$ git config user.name

Step 3: Change Git Repository Username

Next, change the Username in the Git repository using the “git config user.name” command:

$ git config user.name "Jenny"

After that, verify if the username is changed successfully or not:

$ git config user.name

The below output indicates that we have successfully changed the username:

We have taught you the method to change the Git username in the Git terminal.

Conclusion

To change the username in the Git terminal, first, open the “Git Bash” Git terminal. Next, in order to set or change the Git username globally, use the “$ git config –global user.name <Name>” command. Whereas, to set the Git local repository username, utilize the “$ git config user.name <Name>” command. This article has elaborated on the method to change the Git username in the terminal.

About the author

Rafia Zafar

I am graduated in computer science. I am a junior technical author here and passionate about Programming and learning new technologies. I have worked in JAVA, HTML 5, CSS3, Bootstrap, and PHP.