Remove credentials from Git
I’m working with several repositories, but lately I was just working in our internal one and all was great.
Today I had to commit and push code into other one, but I’m having some troubles.
$ git push appharbor master error: The requested URL returned error: 403 while accessing https://email@example.com/mitivo.git/info/refs?service=git-receive-pack fatal: HTTP request failed
There is nothing I can do, that would bring the password entry again.
How can I reset the credentials on my system so Git will ask me for the password of that repository?
I have tried:
git config --global --unset core.askpass
in order to unset the password
git config credential.helper 'cache --timeout=1'
in order to avoid credentials cache…
Nothing seems to work; does anyone have a better idea?
14 Solutions collect form web for “Remove credentials from Git”
The Git credential cache runs a daemon process which caches your credentials in memory and hands them out on demand. So killing your git-credential-cache–daemon process throws all these away and results in re-prompting you for your password if you continue to use this as the cache.helper option.
You could also disable use of the Git credential cache using
git config --global --unset credential.helper. Then reset this, and you would continue to have the cached credentials available for other repositories (if any). You may also need to do
git config --system --unset credential.helper if this has been set in the system configuration file (for example, Git for Windows 2).
On Windows you might be better off using the manager helper (
git config --global credential.helper manager). This stores your credentials in the Windows credential store which has a Control Panel interface where you can delete or edit your stored credentials. With this store, your details are secured by your Windows login and can persist over multiple sessions. The manager helper included in Git for Windows 2.x has replaced the earlier wincred helper that was added in Git for Windows 184.108.40.206. A similar helper called winstore is also available online and was used with GitExtensions as it offers a more GUI driven interface. The manager helper offers the same GUI interface as winstore.
Extract from the Windows manual detailing the Windows credential store panel:
Open User Accounts by clicking the Start button Picture of the Start button, clicking Control Panel, clicking User Accounts and Family Safety (or clicking User Accounts, if you are connected to a network domain), and then clicking User Accounts. In the left pane, click Manage your credentials.
$ git config credential.helper store
And then you will be prompted to enter your credentials again.
Using this helper will store your passwords unencrypted on disk
If this problem comes on a Windows machine, do the following.
- Go to Credential Manager
- Go to Windows Credentials
- Delete the entries under Generic Credentials
- Try connecting again. This time, it should prompt you for the correct username and password.
I found something that worked for me. When I wrote my comment to the OP I had failed to check the system config file:
git config --system -l
line. I unset it with
git config --system --unset credential.helper
and now the credentials are forgotten.
I faced the same issue as the OP. It was taking my old Git credentials stored somewhere on the system and I wanted to use Git with my new credentials, so I ran the command
$ git config --system --list
Whenever I performed
git push it was taking my old username which I set long back, and I wanted to use new a GitHub account to push changes. I later found that my old GitHub account credentials was stored under
Control Panel → User Accounts → Credential Manager → Manage Windows Credentials.
I just removed these credentials and when I performed
git push it asked me for my GitHub credentials, and it worked like a charm.
Try using the below command.
Here you can get various options to manage your credentials (check the below screen).
Or you can even directly try this command:
git credential-manager uninstall
This will start prompting for passwords again on each server interaction request.
In my case, Git is using Windows to store credentials.
All you have to do is remove the stored credentials stored in your Windows account:
Remove this line from your .gitconfig file located in the Windows’ currently logged-in user folder:
[credential] helper = !\"C:/Program Files (x86)/GitExtensions/GitCredentialWinStore/git-credential-winstore.exe\"
This worked for me and now when I push to remote it asks for my password again.
You can remove the line credential.helper=!github –credentials from the following file C:\Program Files\Git\mingw64\etc\gitconfig in order to remove the credentials for git
In my case, I couldn’t find the credentials saved in the Windows Credential Manager (Windows 7).
I was able to reset my credentials by executing
git config --global credential.helper wincred
It was honestly a hail Mary to see if it would wipe out my credentials and it actually worked.
In Windows 2003 Server with “wincred”*, none of the other answers helped me. I had to use
cmdkey /listlists all stored credentials.
cmdkey /delete:Targetdeletes the credential with “Target” name.
(* By “wincred” I mean
git config --global credential.helper wincred)
In our case, clearing the password in the user’s .git-credentials file worked for us.
Reset of password in Credential manager sorted it out for me
If you are authenticated using your key pair, you can deleting or moving your private key, or stopping the key agent and trying.