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

tcs picture tcs · Jul 28, 2016 · Viewed 8.6k times · Source

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

Answer

Eldhose Abraham picture Eldhose Abraham · Jan 5, 2018

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.