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

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

$ 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 10,转到下面的路径,

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

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

2. Web证书。Windows凭据。

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

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

其他回答

如果此问题发生在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.

为了添加到@ericbn的https://stackoverflow.com/a/41111629/579827,我在一个脚本中嵌入了一些示例命令,以便在密码更新时更新它们。它可能不是可用的,因为它是非常具体的,但它显示了cmdkey.exe的实际使用。

机场当局:这是在cygwin机场运行的shell程式码 机场当局说:“这是有效的,因为我使用私人git回购系统,所有的验证都使用相同的密码(你可能不想重复使用相同的凭据,但你可以重复使用这个样例/列表命令来提取已注册凭据的列表)

entries=`cmdkey.exe /list: | grep git | sed -r -e 's/^[^:]+:\s*(.*)$/\1/gm'`
for entry in ${entries}
do
    cmdkey.exe "/delete:${entry}"
    cmdkey.exe "/generic:${entry}" "/user:${GIT_USERNAME}" "/pass:${GIT_PASSWORD}"
done

在我的Win 10上,找不到Windows凭据管理器和。git-credentials。 有效的方法是打开Git GUI并推送代码。然后它请求凭据,这也更新了我Git Bash缓存的密码。

重新输入:

$ git config credential.helper store

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

警告

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

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

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

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

像下图:

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

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