Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I change/switch user credentials used by git command line? (Windows 10, Git 2.9.2)

I'm having issues accessing my private GitHub repos. I believe the source of the problem is the user credentials that are "magically" used by Git (v 2.9.2 on Windows).

I've been using multiple Git Accounts. It doesn't seem to be enough to change my user.name and user.email (git config --global user.name).

The problem occurs when I attempt to access a GitHub repo (clone, or push), this results in the following message:

remote: Repository not found.
fatal: repository 'https://github.com/userxyz/repoxyz.git/'     not found

I have my global (and local) user.name and user.email set correctly, but I believe the git is using the wrong credentials (cached from previous access to another account).

I've done a bit of searching on this, and have not found any useful information (There seems to be multiple credential managers/schemes... I'm using the default one that is now installed with the latest git (2.9.2) for windows).

NOTE: I have found a workaround -- that is, remove the existing origin, and the re-add it with the full (credentials included) path name... for example:

git remote add origin https://userxyz:[email protected]/userxyz/repoxyz.git

This is a rather in-elegant way of handling this problem. I'd rather know how to switch - and manage - the user credentials that Git is "magically" using in the background.

Does anyone know how to handle such issues - switch users credentials within this context?

Thanks

like image 574
tcs Avatar asked Jul 28 '16 13:07

tcs


People also ask

How do I change my git credentials in Windows 10?

Go to Control Panel > User Accounts > Credential Manager > Windows Credentials. You will see Git credentials in the list (e.g. git:https://). Click on it, update the password, and execute git pull/push command from your Git bash and it won't throw any more error messages.

How do I change git bash credentials in Windows?

To update your credentials, go to Control Panel → Credential Manager → Generic Credentials. Find the credentials related to your Git account and edit them to use the updated password.


2 Answers

Go to Control Panel\All Control Panel Items\Credential Manager . There could be a Generic Credential for GitHub. You can update the user name and password there.

like image 185
Eldhose Abraham Avatar answered Nov 15 '22 08:11

Eldhose Abraham


Did you try going to Windows Credential Manager in the control panel and either changing the applicable entry under Generic Credentials or removing it?

like image 44
Aravind Balla Avatar answered Nov 15 '22 08:11

Aravind Balla