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

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

$ 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凭据管理器for Windows(当前版本通常使用):

git credential-manager clear

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

git config --global credential.helper
→ manager

其他回答

在Windows 2003服务器的“wincred”*,没有其他答案帮助我。我必须使用cmdkey。

Cmdkey /list列出所有存储的凭证。 cmdkey /delete:Target删除名称为“Target”的凭据。

(*这里的“wincred”指的是git配置——全局凭据。助手wincred)

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

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

git config --global credential.helper wincred

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

如果你的凭据存储在凭据助手中(通常情况下),移除特定主机的密码持久化的可移植方法是调用git credential reject:

一句话: $ echo "url=https://appharbor.com" | git证书拒绝 或交互: $ git凭证拒绝 = https协议 主机= gitlab.com 用户名= me@example.com ↵ (是回车符号),在输入结束时按两次回车键,不要复制/粘贴 wincred似乎无法识别用户名,因此避免在Windows上通过用户名进行过滤

然后,输入git fetch来输入新密码。

https://git-scm.com/docs/git-credential

需要登录各自的github用户名和密码

清除windows下的用户名和密码

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

编辑windows凭证

删除现有用户,现在转到命令提示符写入推送命令,它会显示一个github弹出输入用户名/电子邮件和密码。

现在我们可以在切换用户后推送代码。

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

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

$ 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