我正在使用几个存储库,但最近我只在我们的内部存储库中工作,一切都很好。

今天我不得不提交并将代码推到另一个,但我遇到了一些麻烦。

$ 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

没有什么我能做的,这将再次带来密码输入。

我如何重置系统上的凭据,以便Git询问我该存储库的密码?

我试过:

Git配置——global——unset core.askpass

以便取消设置密码

Git配置凭证。Helper '缓存超时=1'

为了避免凭证缓存…

似乎什么都不管用;谁有更好的主意?


当前回答

git config --list

将显示证书。Helper = manager(这是在Windows机器上)

要禁用当前本地git文件夹的缓存用户名/密码,只需输入

git config credential.helper ""

这样,git每次都会提示输入密码,忽略“管理器”中保存的内容。

其他回答

当您在同一台机器上使用多个Git帐户时,将出现此错误。

如果你使用的是macOS,那么你可以删除github.com保存的凭据。

请按照以下步骤删除github.com凭据。

开放钥匙串访问 找到github 选择github.com并右键单击它 删除“github.com” 再次尝试推或拉git,它将要求凭据。 为存储库帐户输入有效凭据。 完成

从Windows当前登录用户文件夹中的。gitconfig文件中删除这一行:

[credential]
helper = !\"C:/Program Files (x86)/GitExtensions/GitCredentialWinStore/git-credential-winstore.exe\"

这对我来说很有效,现在当我按下遥控器时,它又会要求我输入密码。

请执行以下命令-

git config --global credential.helper cache

然后运行任何git命令,比如git pull,它会要求输入用户名和密码。输入详细信息,如果您想存储您的git凭据,请运行以下命令-

git config --global credential.helper store

在我的情况下,我找不到保存在Windows凭证管理器(Windows 7)中的凭据。

我可以通过执行重置我的凭证

git config --global credential.helper wincred

老实说,这是孤注一掷,看看它是否会抹掉我的证书,而且它真的起作用了。

如果使用Git凭据管理器for Windows(当前版本通常使用):

git credential-manager clear

这是在2016年年中增加的。检查是否使用了凭据管理器。

git config --global credential.helper
→ manager