How to Set Git Username and Password in GitBash?
Last Updated :
08 Apr, 2025
Setting up your Git username and password is an essential step when working with Git repositories. It helps you confirm your identity when sending (pushing) changes or getting (pulling) updates from a remote repository.
In this guide, we will show you how to easily set your Git username and password using Git Bash, a tool that helps you manage your Git projects. By following these simple steps, you’ll be ready to start working with Git without any hassle.
What is Git Bash?
Git Bash is a command-line interface application that provides a Unix-like Terminal Environment on Windows operating systems. It allows users to interact with Git, a version control system, and run Unix commands directly from the command line. Git Bash also includes a set of Bash utilities and Git commands for managing repositories, making it easier for users familiar with Unix-like environments to work with Git on Windows.
How to Set Git Username and Password in GitBash
Follow the below easy steps to Set Git Username and Password in Gitbash:
Step 1: Open Git Bash
After you've installed Git, go to the folder where you want to open Git Bash. Right-Click in the Folder and select "Git Bash Here" This will open the Git Bash terminal in that folder.

Git Bash opened on Desktop.Step 2: Set your Username
To set your Git Username, run the following command in Git Bash:
$ git config --global user.name "GeeksforGeeks"

Step 3: Set your Email
After that, you will have to configure your email. For that, type
$git config --global user.email "[email protected]"

Step 4: Set your Password
Git doesn’t directly store passwords in the configuration file, but you can set up a credential helper to store your password securely for future use. Run this command:
$git config --global user.password "1234321"

Step 5: Store Credentials Permanently
To avoid entering your username and password every time, use the following command to store your credentials
$ git config --global credential.helper store

This is how you set git username and password in git bash.
To check the inputs, type the below command as depicted:
$ git config --list --show-origin

Similar Reads
How to Save Username And Password in Git? Managing credentials efficiently is important for seamless interaction with remote Git repositories. By default, Git prompts for a username and password each time you interact with a remote repository. To simplify this process, you can configure Git to save your credentials, allowing for a smoother
3 min read
How to Change Git Username in Terminal? Suppose you're using Git for version control. In that case, you might want to change your Git username for various reasonsâwhether it's for correcting a typo, updating it to a new username, or switching to a different account. You can change your Git username in two ways:Globally: This sets the user
3 min read
How To Use Git And GitHub? Git and GitHub are important tools for modern software development, enabling version control, collaboration, and efficient code management. This guide provides an overview of how to use Git and GitHub, from setting up your environment to contributing to projects. Table of Content What is Git?What is
4 min read
Git - How to Solve "remote: Invalid username or password. fatal: Authentication failed"? Encountering the "remote: Invalid username or password. fatal: Authentication failed" error can be frustrating, especially when you're trying to push or pull changes to a Git repository. This issue is commonly related to authentication problems with your Git remote repository. In this article, we'll
3 min read
How to Install and Use GIT in Android Studio? Git is created by Linus Torvald. Git is the most popular Version Control System in the world, used by millions of developers. It helps us to keep track of all the files in a project. Git tracks every change that are made. If we make a mistake, it can reset a file to match a previous version or we ca
4 min read