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

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

$ 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 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用户名(我需要的正确的一个),然后相关的密码,一切都被正确推送。

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

重新输入:

$ git config credential.helper store

然后系统会提示您再次输入您的凭证。

警告

使用此帮助程序将未加密的密码存储在磁盘上

来源:https://git-scm.com/docs/git-credential-store

转到C:\Users\<current-user> 检查.git-credentials文件 根据您的要求删除或修改内容 重新启动终端

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

rm $env:LOCALAPPDATA\GitCredentialManager\tenant.cache

或在Cmd.exe中

rm %LOCALAPPDATA%\GitCredentialManager\tenant.cache

macOS用户:

当您在同一台机器上使用多个Git帐户时,将出现此错误。

请按照以下步骤删除github.com凭据。

打开Finder 进入应用程序 转到实用工具文件夹 开放钥匙串访问 选择github.com并右键单击它 删除“github.com”

再次尝试推或拉git,它将要求凭据。 为存储库帐户输入有效凭据。 完成,现在为答案投票。