Github 认证但不允许代码推送

标签 git github

我是“项目”存储库的所有者,但不知何故我无法推送它。

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 之一。有两种处理方法:

  1. 从您的 SSH 代理中删除所有 key ,然后仅重新添加正确的帐户 key 。

    ssh-add -D
    ssh-add /path/to/correct/key
    
  2. 使用 HTTPS instead of SSH .您可以通过 changing the remote URL 轻松做到这一点origin 使用 HTTPS 方案而不是 SSH。

其中一个或另一个应该有效,除非您只是完全出示了错误的凭据。

关于Github 认证但不允许代码推送,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33467474/

相关文章:

git - 源树错误 : 'git status' failed with code 128: error: inflate: data stream error (incorrect header check)

windows - Windows 上 git log 中的颜色和作者?

git - Git : "ssh: connect to host gitlab port 22: connection refused" 的问题

php - 在 Azure 上从 GitHub 部署 PHP 应用程序失败

ios - 不正确的行为 git 子模块

git - 如何将 Hudson 构建指向我的本地 git 存储库?

github - 整理github star

git - Trac 1.0 无法浏览 Git 存储库的源代码

git - 在 Git 中 checkout 时感到困惑

linux - 关于 remote.origin.url