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
To add to @ericbn 's https://stackoverflow.com/a/41111629/579827 here are sample commands I've embedded in a script I run to update all my passwords whenever they are renewed. It's probably not usable as-is as it's quite specific but it shows real life usage of cmdkey.exe
.
⚠ This is a shell script run in cygwin ⚠
⚠ This works because I use private git repos that all authenticate with the same password (you probably don't want to loop over with the same credentials, but you may reuse this sample
/list
command to extract a list of already registered credentials) ⚠
entries=`cmdkey.exe /list: | grep git | sed -r -e 's/^[^:]+:\s*(.*)$/\1/gm'`
for entry in ${entries}
do
cmdkey.exe "/delete:${entry}"
cmdkey.exe "/generic:${entry}" "/user:${GIT_USERNAME}" "/pass:${GIT_PASSWORD}"
done
If your credentials are stored in the credential helper (generally the case), the portable way to remove a password persisted for a specific host is to call git credential reject
:
in one line:
$ echo "url=https://appharbor.com" | git credential reject
or interactively:
$ git credential reject
protocol=https
host=gitlab.com
username=me@example.com
↵
After that, to enter your new password, type git fetch
.
https://git-scm.com/docs/git-credential
For Windows 10, go to below path,
Control Panel\User Accounts\Credential Manager
There will be 2 tabs at this location,
Click on Windows credentials tab and here you can see your stored github credentials, under "Generic credentials" heading.
You can remove those from here and try and re-clone - it will ask for username/password now as we have just removed the stored credential from the Windows 10 systems
Try this when nothing as mentioned above is working for you.
git config credential.helper 'cache --timeout=30'
this will remove the cache every 3sec and will ask for username and password.You can re-run the command with increased timeout values.
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.
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.