赞
踩
本文翻译自: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://gavekortet@appharbor.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? 如何重置系统上的凭据,以便Git询问我该存储库的密码?
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? 有谁有更好的主意吗?
参考:https://stackoom.com/question/12XLq/从Git删除凭证
如果使用密钥对进行了身份验证,则可以删除或移动私钥,或者停止密钥代理并尝试。
The Git credential cache runs a daemon process which caches your credentials in memory and hands them out on demand. Git凭证缓存运行一个守护进程,该进程将您的凭证缓存在内存中并按需分发。 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. 因此,杀死git-credential-cache--daemon进程会丢弃所有这些东西,如果继续使用它作为cache.helper选项,则会导致重新提示您输入密码。
You could also disable use of the Git credential cache using git config --global --unset credential.helper
. 您还可以使用git config --global --unset credential.helper
禁用Git凭据缓存。 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). 如果已在系统配置文件(例如,用于Windows 2的Git)中设置了git config --system --unset credential.helper
则可能还需要执行git config --system --unset credential.helper
。
On Windows you might be better off using the manager helper ( git config --global credential.helper manager
). 在Windows上,最好使用管理器帮助器 ( 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. 这会将您的凭据存储在Windows凭据存储中,该凭据存储具有控制面板界面,您可以在其中删除或编辑存储的凭据。 With this store, your details are secured by your Windows login and can persist over multiple sessions. 通过此存储,您的详细信息受Windows登录名保护,并且可以在多个会话中保留。 The manager helper included in Git for Windows 2.x has replaced the earlier wincred helper that was added in Git for Windows 1.8.1.1. Windows 2.x的Git中包含的管理器帮助程序已替换了Windows 1.8.1.1的Git中添加的较早的wincred帮助程序。 A similar helper called winstore is also available online and was used with GitExtensions as it offers a more GUI driven interface. 一个类似的名为winstore的帮助程序也可以在线获得,并与GitExtensions一起使用,因为它提供了更多的GUI驱动界面。 The manager helper offers the same GUI interface as winstore . 管理器帮助程序提供与winstore相同的GUI界面。
Extract from the Windows manual detailing the Windows credential store panel: 从Windows手册中摘录,详细介绍Windows凭据存储面板:
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. 在左窗格中,单击“管理您的凭据”。
Remove this line from your .gitconfig file located in the Windows' currently logged-in user folder: 从Windows当前登录用户文件夹中的.gitconfig文件中删除以下行:
- [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. 这对我有用,现在当我按下遥控器时,它会再次要求我输入密码。
Retype: 重新输入:
$ git config credential.helper store
And then you will be prompted to enter your credentials again. 然后将提示您再次输入您的凭据。
WARNING 警告
Using this helper will store your passwords unencrypted on disk 使用此帮助程序会将密码未加密地存储在磁盘上
Source: https://git-scm.com/docs/git-credential-store 资料来源: https : //git-scm.com/docs/git-credential-store
I found something that worked for me. 我找到了对我有用的东西。 When I wrote my comment to the OP I had failed to check the system config file: 当我向OP写评论时,我未能检查系统配置文件:
git config --system -l
shows a 显示一个
credential.helper=!github --credentials
line. 线。 I unset it with 我取消了
git config --system --unset credential.helper
and now the credentials are forgotten. 现在忘记了凭据。
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。