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

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

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

为了避免凭证缓存…

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


当前回答

您可以删除一行credential.helper=!github——从以下文件C:\Program Files\Git\mingw64\etc\gitconfig中的凭据,以便删除git的凭据

其他回答

在我们的例子中,清除用户的.git-credentials文件中的密码是有效的。

c:\users\[username]\.git-credentials

如果此问题发生在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 2003服务器的“wincred”*,没有其他答案帮助我。我必须使用cmdkey。

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

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

如果git配置凭据。helper返回Manager - Core(来自跨平台GCM - Git Credential Manager Core项目),你可以:

保持这个设置不变 使用跨平台GCM命令删除您的凭证: printf "Host=github.com\nusername=xxx\nprotocol=https" | \ Git证书管理器核心擦除

检查它是否被带走:

  printf "Host=github.com\nusername=xxx\nprotocol=https" | \
    git credential-manager-core get

(用你的GitHub用户名替换xxx) (将github.com替换为实际的远程Git存储库托管服务器:gitlab.com, bitbucket.com, yourOwnServer.com)

如果您看到提示您的凭据,单击“取消”:之前的凭据已从操作系统底层机密管理器(Windows凭据管理器,Linux libsecret或Mac osxkeychain)中消失)

在下一次git推送时,通过GCM-core凭据助手输入您的凭据作为提示符:您的新凭据将被存储。

尝试使用下面的命令。

git credential-manager

在这里,您可以获得各种选项来管理您的凭证(检查下面的屏幕)。

或者你甚至可以直接尝试这个命令:

git credential-manager uninstall

这将在每次服务器交互请求时再次提示输入密码。