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

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

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

为了避免凭证缓存…

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


当前回答

macOS用户:

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

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

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

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

其他回答

重新输入:

$ git config credential.helper store

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

警告

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

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

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

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

这种方法对我来说是有效的,并且不受操作系统的影响。这有点笨拙,但很快,让我重新输入凭证。

只需找到您希望重新输入凭据的远程别名。

$ git remote -v 
origin  https://bitbucket.org/org/~username/your-project.git (fetch)
origin  https://bitbucket.org/org/~username/your-project.git (push)

复制项目路径(https://bitbucket.org/org/~username/your-project.git)

然后取下遥控器

$ git remote remove origin

然后再加回去

$ git remote add origin https://bitbucket.org/org/~username/your-project.git

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

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

像下图:

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

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

在我的情况下,我找不到保存在Windows凭证管理器(Windows 7)中的凭据。

我可以通过执行重置我的凭证

git config --global credential.helper wincred

老实说,这是孤注一掷,看看它是否会抹掉我的证书,而且它真的起作用了。