How to change git username and password on PC

featured Image

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.

To change git user name and email, we have to open the terminal and change the user name using git config user.name command and email using git config user.email command.

The git config command helps us to set configuration values on global or local projects.

Let’s see how to do it locally and globally in the examples below.

Change Git username and username on specific local repo

Follow the steps below to change the username and password:

Step 1 : Navigate to the 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 "[email protected]"

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 "[email protected]"

Related Topics:

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

How To Check GitHub Email Address And Username From Terminal?

How to Create New Folder in Github Repository?

How to add empty folder/directory in Git

How to remove node_modules from github or bitbucket

How to change image size in markdown in GitHub

Related Posts

git commands with example

Top 40 Git commands with Examples

GitHub has become an essential tool for developers to manage, store, and collaborate with other developers on software projects. With its simple powerful git-based version control system, GitHub allows users…

Read more
Check GitHub Account in the Terminal

Check GitHub Account in the Terminal

GitHub is an integral tool for developers to store, manage, and collaborate on software projects with other developers. And as we work more and more in the command line it…

Read more
featured Image

How to make list of objects in Netlify CMS using list and object Widget

Here in this Netlify CMS tutorial we will how easily we can make a list of objects using list and object widgets. This will allow us to add multiple objects…

Read more