面临的问题:
我无法 git push
到我的存储库,错误消息:
remote: Permission to fishercoder1534/Leetcode.git denied to MY_OLD_GITHUB_ACCOUNT
fatal: unable to access 'https://github.com/fishercoder1534/Leetcode.git/':
The requested URL returned error: 403`
我所做的研究:
- 看看这个 post ,我所有这些都正确指向我的新 github 帐户: ojit_代码
- 我已经删除了旧的 ssh key ,生成了新的 ssh key ,将它们放在 ~/.ssh/下,并将它们添加到我的新 Github 帐户中。
- 我已经按照上述帖子的建议创建了一个 ~/.ssh/config 文件,其中包含以下内容: ojit_代码
- 我已经运行了
git config --global user.name "NewAccountFirstname NewAccountLastname" git config --global user.email "<a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="cfa2b690a1aab890a8a6bba7baad90aeacaca0baa1bb90aaa2aea6a38fa8a2aea6a3e1aca0a2" rel="noreferrer noopener nofollow">[email protected]</a>"
,其中全部显示了我的新 Github 帐户信息。 ojit_代码 - 我已经运行了
Host github.com User git IdentityFile ~/.ssh/id_rsa # wherever your "new" key lives IdentitiesOnly yes
,它还显示了我的新 Github 信息,其中包含$ssh -vT <a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="05626c7145626c716d70672b666a68" rel="noreferrer noopener nofollow">[email protected]</a>
下一个尝试/帮助的选项是什么?
最佳答案
https 网址 ( https://github.com/fishercoder1534/Leetcode.git ) 意味着您为 ssh 所做的每项设置都不重要。
user.name
/user.email
与 Git 存储库服务器身份验证无关。
检查您是否已在凭证管理器中缓存了您的 https github.com
凭证 git credential.helper
:
git config credential.helper
这可以解释为什么您的旧帐户继续被使用。
对于osxkeychain
,you can update your account
或者,当然,您可以切换到 ssh url:
git remote set-url origin <a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="85e2ecf1c5e2ecf1edf0e7abe6eae8" rel="noreferrer noopener nofollow">[email protected]</a>:fishercoder1534/Leetcode.git
关于linux - Github - 旧帐户的权限被拒绝,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41658415/