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

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

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

为了避免凭证缓存…

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


当前回答

如果此问题发生在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当前登录用户文件夹中的。gitconfig文件中删除这一行:

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

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

对于Windows 10,转到下面的路径,

控制面板\用户帐户\凭证管理器

在这个位置会有两个标签,

2. Web证书。Windows凭据。

点击Windows凭据标签,在这里你可以看到你存储的github凭据, 在“一般证书”标题下。

你可以从这里删除这些,并尝试重新克隆-它会要求用户名/密码,因为我们刚刚从Windows 10系统中删除了存储的凭据

Mac设备的答案:

应用程序/实用程序/密钥链Acccess

搜索git。并删除所需URL的git凭据。

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

git credential-manager clear

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

git config --global credential.helper
→ manager

实际上useHttpPath是一个git配置,它应该适用于所有gcm。纠正。

原题摘要

在Windows上使用git 在GitHub上开发多个存储库 用于另一个GitHub存储库的错误凭据

虽然标题说“删除凭据”,但描述让我假设你可能在GitHub上有多个帐户,例如用于与工作相关的或私人项目。(至少那期杂志让我找到了这个话题。) 如果是这样,继续读下去,否则,忽略这个答案,但它在某些时候可能会派上用场。

原因

Git凭据管理器(简称GCM),就像微软的GCM一样,默认情况下为每个主机存储凭据。 这可以通过检查Windows凭据管理器来验证(参见关于如何在英语、法语和德语Windows版本上访问它的其他答案)。 因此,在同一主机上使用多个帐户(这里是github.com)在默认情况下是不可能的。

2020年10月,Windows版GCM已弃用,并被GCM Core所取代。这里的信息仍然适用于新的GCM,它甚至应该使用GCM为Windows存储的凭证。

解决方案

配置git以包含存储库的完整路径,作为每个凭据条目的附加信息。在Windows的GCM中也有文档。 我个人更喜欢包含HTTP(S)[存储库]路径,以便能够为每个存储库使用单独的帐户。

对于所有可能的主机:

git config --global credential.useHttpPath true

仅适用于github.com:

git config --global credential.github.com.useHttpPath true

看看GCM和git文档,也许你想指定一些不同的东西。