Git命令行认为我是以前使用过的帐户

  • 本文关键字:命令行 Git git github
  • 更新时间 :
  • 英文 :


我的git安装似乎认为我仍然是以前的用户,尽管我已经经历了删除它的长度。

目前我得到的唯一反馈是这个错误信息

remote: Permission to Mike4driver/LoftyPracticalDjangoProject.git denied to MikeTokensoft.
fatal: unable to access 'https://github.com/Mike4driver/LoftyPracticalDjangoProject.git/': The requested URL returned error: 403

MikeTokensoft是我以前用于工作的帐户,我正试图切换回我的个人帐户。我在全局配置中将我的工作邮箱切换为我的个人邮箱,并验证了这已经更改,并且在我本地做的新提交中显示为这样。我的旧帐户有一个访问令牌,我正在使用它,我删除了。我的理解是,这是位于我的。git-credentials文件中的内容,所以我删除了那里的所有内容,只有那一行。然后我从git配置中删除了[credentials]部分下的所有内容。

我不确定我还可以在哪里找到我的机器目前从哪里拉出MikeTokensoft身份,以及如何删除它。下面是我的git config -l

的输出
user.email=My Real email that I replaced for stackoverflow
user.name=My Real Name that I replaced for stackoverflow
core.repositoryformatversion=0
core.filemode=true
core.bare=false
core.logallrefupdates=true
remote.origin.url=https://github.com/Mike4driver/LoftyPracticalDjangoProject.git

如有任何建议,不胜感激。

先检查你的git凭证助手:

git config --global credential.helper

如果得到一个值(比如xxx),检查helper中存储的内容:

printf "host=github.comnprotocol=https" | git-credential-xxx get

如果您看到旧的令牌,对于旧的帐户,删除它,并存储新的。

printf "host=github.comnprotocol=httpsnusername=Mike4driver" | git-credential-xxx erase
printf "host=github.comnprotocol=httpsnusername=NewAccountnpassword=yourToken" | git-credential-xxx store

最新更新