Github The requested URL returned error: 403 remote: Permission to user

Github The requested URL returned error: 403 remote: Permission to user

我有两个 GitHub 帐户,有两个不同的电子邮件 ID,

目前我的.gitconfig如下;

[filter "lfs"]
    process = git-lfs filter-process
    clean = git-lfs clean -- %f
    smudge = git-lfs smudge -- %f
    required = true
[user]
    name = joshinachiket
    email = nachiket.r.joshi@gmail.com
[core]
    autocrlf = true
    excludesfile = C:\Users\NACHIKET\Documents\gitignore_global.txt

不过,当我想提交到存储库时,它说,

remote: Permission to joshinachiket/CMPE295-enterprise-grade-botman.git denied to TheBloodMage.
fatal: unable to access 'https://github.com/joshinachiket/CMPE295-enterprise-grade-botman.git/': The requested URL returned error: 403

其中 TheBloodMage 是我来自其他 github 电子邮件 ID 的用户 ID。

我在问题中显示的 .gitconfig 内容属于我创建存储库的帐户,ID TheBloodMage 属于其他 github 帐户(我的老)我不想授予访问权限。

所以基本上,

  1. 我创建了一个带有 github ID 的存储库 - joshinachiket

  2. 我使用 .gitconfig 将存储库克隆到计算机上,显示与上面所示相同的 ID 和电子邮件

  3. 仍然,错误表明 TheBloodMage 没有访问存储库的权限。

我被这个问题困了很久了... 谁能告诉我我做错了什么?

您有 GitHub 个存储库:http://github.com/user_name/repository_name

您有 2 个帐户,您希望另一个帐户访问现有存储库。

转到https://github.com/user_name/repository_name/settings/collaboration

喜欢这个

仔细检查您是否有 credential helper 缓存您的(旧帐户)凭据 (username/password) 用于对您进行身份验证。

git config credential.helper 

在 Windows 上,那将是
打开 Windows 凭据存储,查看第一个用户是否已在此处注册:删除该条目,您将能够对第二个用户进行身份验证。

(这里以 BitBucket 为例)