Git

Configuring User and Password With Git Bash

When a developer works in a Git environment, they need a terminal for performing operations through different commands. The “Git bash” can be utilized for this corresponding purpose. It replicates a bash terminal on Windows, allowing developers to utilize all Git tools or commands from the command line.

To start working on Git, developers are required to configure the username and password first. To do so, the “$ git config user.name <name>” and “$ git config user.password <password>” commands can be used along with the “–global” parameter for configuring the username and password globally with the help of Git bash.

This guide discusses:

How to Configure User With Git Bash?

To configure the username with the help of the command line terminal known as Git Bash, follow the below-listed steps.

Step 1: Navigate to Root Directory

First of all, move to the Git root directory by executing the “cd” command:

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

 

Step 2: Check Configured User

To configure the Git username, first, ensure the user is not configured through the “git config” command along with the “–global” parameter:

$ git config --global user.name

 
According to the below-listed output, no user is configured yet:


Step 3: Configured User

Now, execute the below command along with the username for configuration:

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

 

Step 4: Verification

To verify the specified username is configured, run the below-listed command:

$ git config --global user.name

 
As you can see, the previously specified username is configured successfully:


Let’s move to the next section to learn how to configure the password with Git bash.

How to Configure Password With Git Bash?

To configure the user password in Git, try out the steps below.

Step 1: Check Configured User Password

First, check if the user password is already configured. For this purpose, execute the “git config” command with the “–global” parameter and “user.password” option:

$ git config --global user.password

 
The below output shows that the user password is not configured:


Step 2: Configured User Password

Now, utilize the provided command to configure the user password in Git:

$ git config --global user.password "12345"

 

Step 3: Verification

Lastly, ensure that the specified user password is configured or not:

$ git config --global user.password

 
The below output indicates that the password has been configured successfully:


That’s it! We have explained the method to configure the user and password with the Git bash.

Conclusion

To configure the Git user and password, first, ensure that the username and password are not configured previously. To do so, execute the “$ git config –global user.<name/password>” command. After the verification, run the “$ git config –global user.name <user-name>” command for username and the “$ git config –global user.password <user-password>” command for password configuration. This guide elaborated on the configuration of user and password with Git bash.

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.