如何重置“git credential-osxkeychain"中存储的凭据? [英] How do you reset the stored credentials in 'git credential-osxkeychain'?

查看:50
本文介绍了如何重置“git credential-osxkeychain"中存储的凭据?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已按照 GitHub 说明设置我的帐户,我可以克隆,但无法远程推送.

I've followed the GitHub instructions for setting up my account, and I'm able to clone, but I'm unable to push remotely.

当我执行git push"时,我收到 403 错误.它有正确的 URL.我尝试了一个git credential-osxkeychain get"来查看它提供了什么,这会打印出错误的凭据.

When I do a "git push" I get the 403 error. It has the correct URL. I tried a "git credential-osxkeychain get" to see what it was giving, and this prints out the wrong credentials.

我相信发生的事情是它第一次要求提供凭据,我以为是另一个应用程序要求提供的凭据,但它输入了错误的凭据.

I believe what happened is the first time it asked for the credentials, I thought it was another application asking, and it put the wrong ones in.

我只需要重置它,以便它为我的 GitHub 帐户使用正确的钥匙串项目.

I just need to reset it so that it uses the correct keychain item for my GitHub account.

我试过了:

git credential-osxkeychain erase
git credential-osxkeychain set

程序从不给出任何提示.如果我没有做正确的事情,Set 会说输入错误".我尝试输入password=password"等,但是当我执行get"时,我仍然得到旧的.

The program never gives any prompts. Set will say "bad input" if I don't do the right thing. I tried putting in "password=password", etc., but then when I do a "get" I still get the old ones.

我无法弄清楚这些文件的存储位置,因为它们不在 .gitconfigure 中.此外,没有最近的钥匙串项目可能是它.(我的钥匙串中有几个 GitHub 帐户,但它没有使用任何一个.)

I can't figure out where these are being stored, as they are not in .gitconfigure. Further there are no recent keychain items that could be it. (I have several GitHub accounts in my keychain and it is not using any of them.)

推荐答案

结果是这样的:

命令 git credential-osxkeychain 使用了我钥匙串中的 第一个 GitHub 帐户条目.这个人不是有权访问相关项目的人.

The command git credential-osxkeychain was using the first GitHub account entry in my keychain. This one was not the one that had access to the projects in question.

我通过触摸 Keychain Access 中的帐户解决了问题,以便其日期发生变化(我想我只是更改了评论),现在它成为最新的 GitHub 帐户,它成为第一个返回到 credential-osxkeychain 的帐户,并且因此一切正常.

I resolved the problem by touching the account in Keychain Access so that its date changed (I think I just changed the comment) and now that it became the most recent GitHub account it became the first one returned to credential-osxkeychain, and thus everything worked.

为多个 GitHub 帐户提供更好的支持形式会很好,但很可能大多数人只有一个主帐户并且不会遇到这个问题.

A better form of support for multiple GitHub accounts would be nice, but it is likely that most people only have one primary account and don't run into this problem.

这篇关于如何重置“git credential-osxkeychain"中存储的凭据?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆