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

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

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

为了避免凭证缓存…

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


当前回答

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

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

像下图:

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

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

其他回答

如果您使用密钥对进行身份验证,则可以删除或移动您的私有密钥,或者停止密钥代理并尝试。

git config --list

将显示证书。Helper = manager(这是在Windows机器上)

要禁用当前本地git文件夹的缓存用户名/密码,只需输入

git config credential.helper ""

这样,git每次都会提示输入密码,忽略“管理器”中保存的内容。

在我们的例子中,清除用户的.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凭据管理器for Windows(当前版本通常使用):

git credential-manager clear

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

git config --global credential.helper
→ manager