【问题标题】:Gitea - SSH Auth ok but can't push to remoteGitea - SSH Auth 可以,但无法推送到远程
【发布时间】:2018-06-18 14:36:00
【问题描述】:

我的 Gitea 版本是 1.2.3,它安装在 gentoo 专用服务器上。 我使用我的用户(不是 root 用户)在另一台专用服务器上创建了我的 SSH 密钥。

在 Gitea GUI 上,我为该组织创建了一个组织和一个 repo,我的 gitea 用户是所有这些的所有者(不是 root 帐户)

当我转到 [Organization]/[MyRepo] > 设置 > 部署密钥时,我添加了远程用户的 ssh 密钥。 Gitea 将该密钥添加到 .ssh git 用户中的 authorized_key 文件中(git 用户是 gitea 的用户)

从我的遥控器,当我尝试这样做时:

ssh git@[gitea_server_ip]

我收到了这条消息:

Hi there, You've successfully authenticated, but Gitea does not provide shell access.
If this is unexpected, please log in with password and setup Gitea under another user.

所以 SSH 工作得很好,但是当我尝试推送或克隆时,我明白了:

git push -u origin master

答案:

Gitea: Key permission denied  
Cannot push with deployment key: 5 
fatal: Could not read from remote repository

Please make sure you have the correct access rights and the repository exists.

这似乎是一个gitea认证问题,但我没有找到答案,谢谢。

【问题讨论】:

  • AFAIU 用于推送的 ssh 密钥必须是用户密钥,而不是部署密钥。见github.com/go-gitea/gitea/issues/938
  • 好的,我应该使用什么?因为我使用远程用户生成了密钥并将其用于部署密钥,所以这是错误的方式吗?感谢您的帮助
  • 我找到了关于 Github (1, 2) 和 Gitlab 的部署密钥的以下信息。我认为它与 gogs/gitea 类似——您需要创建新的或使用现有的用户密钥,将其公钥添加到 gitea 帐户并重新配置 ssh 以使用其私钥连接到服务器。
  • 在你告诉我要做的事情中,除了“重新配置 ssh 以使用其私钥连接到服务器”部分之外,我已经做了所有这些,你的意思是什么?因为我不能把私钥给其他服务器,不是吗?
  • 您现在有 2 个 ssh 密钥对——用户密钥和部署密钥。您需要configure ssh 以允许 git 使用其中一个。当然你不会公开你的私钥。

标签: git authentication ssh gitea


【解决方案1】:

如果您使用没有写入权限的部署密钥,或者您的 gitea 版本的写入选项未完成,则会出现此消息。我收到此错误: Gitea: Key permission denied Cannot push with deployment key: 14 fatal: Could not read from remote repository 如果此帐号只有读取权限。

您可以使用标准的 ssh 身份验证:/user/settings/keys 添加您的公钥,然后它应该可以工作。

【讨论】:

  • 什么是“标准 ssh 身份验证”?
  • 使用 autorised_keys 文件的标准 ssh 身份验证也像 gitea 一样
猜你喜欢
  • 2021-01-30
  • 2017-10-14
  • 1970-01-01
  • 2021-04-10
  • 2019-08-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多