linux - Github - 旧帐户的权限被拒绝

标签 linux git shell github ssh

面临的问题:
我无法 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`

我所做的研究:

  1. 看看这个 post ,我所有这些都正确指向我的新 github 帐户: ojit_代码
  2. 我已经删除了旧的 ssh key ,生成了新的 ssh key ,将它们放在 ~/.ssh/下,并将它们添加到我的新 Github 帐户中。
  3. 我已经按照上述帖子的建议创建了一个 ~/.ssh/config 文件,其中包含以下内容: ojit_代码
  4. 我已经运行了 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_代码
  5. 我已经运行了 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

这可以解释为什么您的旧帐户继续被使用。
对于osxkeychainyou 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/

相关文章:

linux - 如何降低 GCC 中的编译成本和 make?

linux - 在 Perl 中以修改后的调度优先级运行 OS 函数

git - 重新验证 git(强制为新用户创建新的 SSH key )

git - 如何更改存储库链接到的复刻

linux - 将变量导出到另一个 bash 脚本

ruby - 使用 Ruby 查找早于 X 小时的文件

linux - linux make 命令的作用是什么?

git - 允许 Github 组织读取存储库

java - 如何调用 Linux shell 并为其设置 PATH?

linux - sed 编辑文件时的额外空字符