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

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

$ 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

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

其他回答

在PowerShell控制台中执行以下命令清除Windows缓存中的Git凭据管理器:

rm $env:LOCALAPPDATA\GitCredentialManager\tenant.cache

或在Cmd.exe中

rm %LOCALAPPDATA%\GitCredentialManager\tenant.cache

在Windows 10专业版上使用最新版本的Windows git,我遇到了类似的问题,我有两个不同的GitHub帐户和一个Bitbucket帐户,所以VS2017、git扩展和git bash的情况有点混乱。

我首先检查了git是如何处理我的凭据与这个命令(运行git bash与提升命令或你得到错误):

git config --list

我找到了条目凭据管理器,所以我点击开始按钮>键入凭据管理器,然后左键单击凭据管理器黄色安全图标,启动了应用程序。然后我点击Windows凭据选项卡,找到了我当前git帐户的条目,碰巧是Bit-bucket,所以我删除了这个帐户。

但这并没有做到这一点,所以下一步是取消凭据,我从我的笔记本电脑上的存储库目录,其中包含我试图推到远程的GitHub项目。我输入了以下命令:

git config --system --unset credential.helper

然后我做了一个git推送,我被提示输入一个GitHub用户名(我需要的正确的一个),然后相关的密码,一切都被正确推送。

我不确定这是一个多大的问题,大多数人可能工作在一个存储库,但我必须跨几个工作,使用不同的提供商,所以可能会再次遇到这个问题。

我遇到了与op相同的问题。它正在取我存储在系统某处的旧Git凭据,而我想将Git与我的新凭据一起使用,所以我运行了该命令

$ git config --system --list

它显示

credential.helper=manager

每当我执行git推送时,它都会使用我的旧用户名,我设置了很久,我想使用新的GitHub帐户来推送更改。我后来发现我的旧GitHub帐户凭据存储在 控制面板→用户帐户→凭证管理器→管理Windows凭证。

我只是删除了这些凭据,当我执行git推送时,它要求我提供我的GitHub凭据,它就像一个魅力。

如果此问题发生在Windows计算机上,请执行以下操作。

Go to Credential Manager in German, it is called: Anmeldeinformationsverwaltung in French, it is called: Gestionnaire d'identification in Polish, it is called: Menedżer poświadczeń in Portuguese, it is called: Gerenciador de Credenciais in Russian, it is called: Диспетчер учётных данных in Spanish, it is called: Administrador de credenciales in Norwegian, it is called: Legitimasjonsbehandling in Czech, it is called: Správce pověření in Dutch, it is called: Referentiebeheer Go to Windows Credentials Delete the entries under Generic Credentials Try connecting again. This time, it should prompt you for the correct username and password.

至少在Windows上,git remote show [remote-name]可以工作。

git remote show origin