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:
- Method 1: Change Git Username Globally in the Terminal
- Method 2: Change Git Username of Local Repository in the 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:
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:
Check the username again to verify if the new username was successfully changed:
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:
Step 2: Check Repository Username
Check the current username in the Git local repository:
Step 3: Change Git Repository Username
Next, change the Username in the Git repository using the “git config user.name” command:
After that, verify if the username is changed successfully or not:
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.