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

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

$ 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'

为了避免凭证缓存…

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


当前回答

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

git config --system -l

显示了一个

credential.helper=!github --credentials

线。我用

git config --system --unset credential.helper

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

其他回答

请执行以下命令-

git config --global credential.helper cache

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

git config --global credential.helper store

在Windows 2003服务器的“wincred”*,没有其他答案帮助我。我必须使用cmdkey。

Cmdkey /list列出所有存储的凭证。 cmdkey /delete:Target删除名称为“Target”的凭据。

(*这里的“wincred”指的是git配置——全局凭据。助手wincred)

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

git credential-manager clear

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

git config --global credential.helper
→ manager

如果你想让git忘记旧保存的凭证并重新输入用户名和密码,你可以使用下面的命令来完成:

git credential-cache exit

运行以上命令后,如果您尝试推送任何东西,它将提供输入用户名和密码的选项。

在项目根文件夹中打开。git/config。该文件包含有关远程url和凭据类型的详细信息。

此文件中的当前远程url可能存储凭据。从github复制远程url并更新配置文件中的url。

像下图:

[remote "origin"]
    url = [update it]
    fetch = +refs/heads/*:refs/remotes/origin/*
[credential]
    helper = manager

现在当你尝试推送你的代码时,它会要求凭证。谢谢