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

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

$ 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每次都会提示输入密码,忽略“管理器”中保存的内容。

其他回答

您必须在凭据管理器中更新它。

进入控制面板>用户帐户>凭据管理器> Windows凭据。您将在列表中看到Git凭据(例如Git:https://).)点击它,更新密码,然后在git bash中执行git pull/push命令,它就不会抛出任何错误消息了。

我找到了适合我的方法。当我给OP写注释时,我没有检查系统配置文件:

git config --system -l

显示了一个

credential.helper=!github --credentials

线。我用

git config --system --unset credential.helper

现在这些证书都被遗忘了。

最终为我解决这个问题的是使用GitHub桌面,进入存储库设置,并从存储库url中删除user:pass@。然后,我尝试从命令行推送,并提示输入登录凭据。我把它们放进去之后,一切都恢复正常了。Visual Studio和命令行都可以工作,当然还有GitHub桌面。

GitHub Desktop->Repository->Repository Settings->Remote选项卡

将主远程存储库(origin)更改为:

https://pork@muffins@github.com/MyProject/MyProject.git

To:

https://github.com/MyProject/MyProject.git

点击“保存”

凭证将被清除。

Git凭据缓存运行一个守护进程,该进程将您的凭据缓存到内存中,并根据需要分发它们。因此,如果您继续使用git-credential-cache- daemon作为缓存,那么终止git-credential-cache- daemon进程将丢弃所有这些,并导致重新提示您输入密码。辅助选项。

你也可以使用Git config——global——unset credential.helper禁用Git凭据缓存。然后重新设置,您将继续拥有缓存的凭据,可用于其他存储库(如果有的话)。你可能还需要执行git config——system——unset credential命令。如果在系统配置文件(例如,Windows 2的Git)中已经设置了helper。

On Windows you might be better off using the manager helper (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. With this store, your details are secured by your Windows login and can persist over multiple sessions. 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. A similar helper called winstore is also available online and was used with GitExtensions as it offers a more GUI driven interface. The manager helper offers the same GUI interface as winstore.

从Windows 10支持页面提取详细的Windows凭据管理器:

要打开凭据管理器,请在任务栏上的搜索框中输入“凭据管理器”,然后选择凭据管理器控制面板。

然后选择Windows凭证来编辑(=删除或修改)存储的给定URL的git凭证。

在我的Win 10上,找不到Windows凭据管理器和。git-credentials。 有效的方法是打开Git GUI并推送代码。然后它请求凭据,这也更新了我Git Bash缓存的密码。