How to change git username and password on PC


Here we will learn how to change username and password locally and globally on git in our computer.

While working with github, if you want to change your github account to commit your future changes, then you can change the account credentials locally only for specific repo or globally for all the repos in your computer.

Change Git username and username on specific local repo

Follow the steps below to change the username and password:

Step 1 : Navigate to your local repo you want to make changes in and open your terminal.

Step 2 : First execute git config --list to check your signed-in username and email in that repo.

Step 3 : Now to change your credential in that specific local repo , type:

git config user.name "User Name"
git config user.email "youremail@gmail.com"

Now when you try to push any changes in the specific repo, a prompt will ask for the password which will be saved for that repo.

Change git credentials globally in your computer.

The global value means changing it for all the local repos in your PC.

To change it globally, we just need to add the --global flag when changing it.

git config --global user.name "User Name"
git config --global user.email "youremail@gmail.com"

Related Topics:

How To Save Username, Email And Password Globally In Github?

How To Check GitHub Email Address And Username From Terminal?


💾 Recommended Articles