-
Notifications
You must be signed in to change notification settings - Fork 593
Resetting stored credentials from command line #99
Comments
@DavidIQ thanks, this is on the backlog for sure. @jeremyepling to help prioritize and schedule. |
Once it is not implemented yet. |
You can just go to Windows Credential Manager in the control panel and either change the applicable entry under Generic Credentials or remove it. |
@DavidIQ thanks a lot, dude! I am not a Windows user, so I did not know where to search for this. 😃 |
Sorry about my english, BTW. |
Hey, I understood you - and I guarantee you would not understand me in your native language. So kudos to you. 😄 |
I know this is a few years old, but this issue is the first thing to show up when you Google "git clear cached credentials command line windows". If you are using Git, and you are using the Windows Credential Manager to cache your credentials, and you want to reset / clear them from the command line, you can do that using the CMDKEY.EXE command. First, list all the credentials and find the one related to your Git repo: Then, delete it: If you're like me and you're running your Git commands as a different user than the one you are currently logged in to Windows as (since I have a separate Windows account for administrative tasks), you can't open the Windows Credential Manager directly. You would normally have to log out, log in as the second account, THEN open it. That's a pain. This lets you do it from a command prompt. |
Thanks, you're a lifesaver ! |
I needed this very feature, so I went ahead and implemented a dotnet global tool that does this: https://www.nuget.org/packages/dotnet-gcm/
It uses the Git Credential Manager Core, so I'm not sure it would update the older "classic" from this repo though. I'm guessing it would, since the ultimate keychain APIs underneath both are likely the same. |
When doing work on enterprise-level git repositories, i.e. within the organization, many/most times the account used to access the git repositories is tied to the network login. Most organizations have a password expiration rule in place which will mean that anything using your credentials needs to be updated.
For the Git Credential Manager the only way to do this is to go into the Windows Credential Manager and either change the password there for the git instance or delete it and try to do a pull on the repository, which will then ask you for your credentials. Otherwise you'd get an authentication error from the git repository.
Another use case might be for those organizations that have "high-security" git repositories that will only work with the user's second account. In this case it would be a bit of a nuisance to be switching back and forth between the two accounts via Windows Credential Manager.
To "fix" these scenarios it would be nice for Git Credential Manager to either ask for the new credentials (scenario 1) instead of giving a full stop or for there to be a command to manually reset the credentials via the command line (scenario 2), something like
gitcmw --reset
.The text was updated successfully, but these errors were encountered: