我是“项目”存储库的所有者,但不知何故我无法推送它。
user@none ~/rails_projects/project $ git remote -v
origin git@github.com:user/project.git (fetch)
origin git@github.com:user/project.git (push)
这是身份验证检查:
user@none ~/rails_projects/project $ ssh -T git@github.com
Hi user/project! You've successfully authenticated, but GitHub does not provide shell access.
推送尝试:
user@none ~/rails_projects/project $ git push origin qa
ERROR: The key you are authenticating with has been marked as read only.
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
知道如何解决这个错误吗?
最佳答案
您似乎有多个 SSH key ,并且显示的 key 是存储库的部署 key ,而不是具有写入权限的帐户 key 之一。有两种处理方法:
从您的 SSH 代理中删除所有 key ,然后仅重新添加正确的帐户 key 。
ssh-add -D ssh-add /path/to/correct/key
使用 HTTPS instead of SSH .您可以通过 changing the remote URL 轻松做到这一点origin 使用 HTTPS 方案而不是 SSH。
其中一个或另一个应该有效,除非您只是完全出示了错误的凭据。
关于Github 认证但不允许代码推送,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33467474/