git - SSH 密钥在 github 中添加了读/写,但仍然被拒绝权限
问题描述
所以我多年来一直在使用 GitHub,没有任何问题。今天刚好碰到第一个。我创建了一个新帐户,创建了一个新存储库,然后克隆并提交到存储库。基本上,我目前的 GitHub 存储库中有内容。
但是,刚才我尝试使用git commit -am "Updated."
并运行了一个简单的代码git push origin master
来提交我的更改,我遇到了这个错误:
[user:.../scripts/ptscripts]$ git push origin master 12:01PM/05.13
ERROR: Permission to my-github-user/ptscripts.git denied to [obfuscated user].
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
我不明白为什么我会收到这个错误。我的公共 SSH 密钥已添加到我的 GitHub 帐户中,并显示为读/写。[被混淆的用户]。但是,属于另一个 GitHub 用户帐户,所以我不太确定它为什么要尝试使用旧用户帐户。
我最近做的唯一一件事就是将权限~/.config
从 root 更改为我的用户帐户,以抑制有关权限被拒绝的警告。除此之外,我没有改变任何东西。
任何建议将不胜感激。
解决方案
您似乎没有更改 github.com 的 SSH 密钥。GitHub 通过使用的 SSH 密钥来区分用户。
~/.ssh/config
换键方便。我对 github.com 的配置是这样的。
Host github.com
user git
IdentityFile ~/.ssh/set0gut1.key
# IdentityFile ~/.ssh/old-account.key
推荐阅读
- reactjs - 24 小时后对复选框的更改值做出反应
- kotlin - Kotlin 脚本构建失败
- bazel - Monorepo 与多个连接的 Bazel 工作区 - 是否有任何“陷阱”需要考虑?
- dependency-injection - blazor wasm 如何从 di 注入自定义类
- java - jar 未正确创建 mvn relase
- python - 如何使用 ctypes 从 Python 创建 C 结构?
- json - Swift/JSONEncoder:包含嵌套原始 JSON 对象文字的编码类
- c - 运行程序后imac死机
- python - 从网站提取数据时如何绕过验证码。我从 https://jp.indeed.com/ 中提取
- sensors - ESP32 模数 ADC