简体   繁体   English

从git的CLI中清除Windows的bash的所有git凭据

[英]clear all git credentials from the CLI on git for windows' bash

Is there a way to do the above (remove all stored credentials that I added/that I have access to, from the bash CLI), irrespective of how the credentials are stored? 有没有一种方法可以执行上述操作(从bash CLI中删除我添加/可以访问的所有已存储凭据),而不管凭据如何存储?

I use many different public computers, and it would be ideal not to have to figure out how the installation of git and the credentials is working on each. 我使用了许多不同的公用计算机,而不必弄清楚git的安装和凭据如何在每个计算机上工作将是理想的。

Brief google/SO searches wielded no results 简短的google / SO搜索没有结果

In windows 10: 在Windows 10中:

go to Control Panel -> User Accounts -> Credential Manager -> Manage Windows Credentials 转到Control Panel -> User Accounts -> Credential Manager -> Manage Windows Credentials

Search for something like git:https://github..... and remove that. 搜索类似git:https://github.....并将其删除。

There's no one standard way that credentials like this are stored so unfortunately there's no one way to remove them. 像这样的凭据没有一种标准的存储方式,因此很遗憾,没有一种方法可以删除它们。 It isn't git or bash storing them. 存储它们不是git或bash。 In most cases it'll be some sort of keychain on the OS. 在大多数情况下,这将是操作系统上的某种钥匙串。

I'm afraid I don't use Windows so I can't help you there. 恐怕我不使用Windows,所以我无法为您提供帮助。

You would need a bash script (that can work, even on Windows, through a Git for Windows bash), in order to: 您将需要一个bash脚本(即使在Windows上也可以通过Git for Windows bash使用),以便:

  • detect your OS 检测您的操作系统
  • detect the credential helper (if any) set: git config credential.helper 检测设置的凭据助手(如果有):git config credential.helper
  • remove the credentials associated to a given URL passed as parameter of that script; 删除与作为该脚本的参数传递的给定URL关联的凭据;

For instance, see " sign out in the Git Bash console in Windows ": 例如,请参阅“ 在Windows的Git Bash控制台中注销 ”:

git credential-manager reject https://github.com

On Mac, for osxkeychain , see " Updating credentials from the OSX Keychain " 在Mac上,对于osxkeychain ,请参阅“ 从OSX钥匙串更新凭据

git credential-osxkeychain erase https://github.com

The point is: you need a script to automate that step for all possible credential caching mechanism. 关键是:您需要一个脚本来自动化所有可能的凭据缓存机制的步骤。 Then try again: it will prompt for user GitHub username/password. 然后重试:它将提示输入用户GitHub用户名/密码。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM