ssh - 无法通过 ssh 推送到 GitLab 存储库

标签 ssh gitlab

我设置了 GitLab 并将我的存储库放入其中。

我按如下方式制作了 ssh key 并将公钥放入我的 GitLab 个人资料中。好像没问题。

ssh-keygen -t rsa -C "$your_email"

我可以通过 ssh 克隆我的存储库。但我无法通过 ssh 进入它,如下所示。
root@192.168.141.136's password:
Counting objects: 6, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (3/3), done.
Writing objects: 100% (4/4), 337 bytes | 0 bytes/s, done.
Total 4 (delta 1), reused 0 (delta 0)
remote: GitLab: No such user or key
To ssh://root@192.168.141.136/var/opt/gitlab/git-data/repositories/root/reponame.g
it
 ! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'ssh://root@192.168.141.136/var/opt/gitlab/gi
t-data/repositories/root/reponame.git'

我检查了 GitHub 并查看了源代码,很明显没有找到我的用户或 ssh key 。
但这很奇怪,因为我清楚地设置了它们。
        actor = if params[:key_id]
                  Key.find_by(id: params[:key_id])
                elsif params[:user_id]
                  User.find_by(id: params[:user_id])
                end

        unless actor
          return Gitlab::GitAccessStatus.new(false, 'No such user or key')
        end

最佳答案

我误解了整个故事。

Linux 用户和 GitLab 用户完全不相关。

如果我想使用 user_a , user_b , 和 user_c在 GitLab 中,我所要做的就是在 GitLab 中添加这些用户,每个用户都必须创建 ssh key 并在 GitLab 中进行设置。

如果 reponemae.git 是公共(public)存储库,那么所有这些都可以通过 ssh 进行克隆,如下所示。

git clone ssh://git@192.168.141.136://root/reponame.git

关于ssh - 无法通过 ssh 推送到 GitLab 存储库,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28623791/

相关文章:

c - ssh_channel_open_forward 非阻塞

node.js - MongoDB 连接到远程服务器

git - 如何从 GITLAB 仪表板中新创建的 git 分支中删除特定文件和文件夹?

java - 通过java做ssh

混帐狂欢 : Could not open a connection to your authentication agent

git - 在 CI 服务器中构建 merge 请求

Gitlab CI如何将最新部署到特定目录

gitlab - 在 gitlab-ci.yml 上动态设置工件路径/文件夹结构

python - 有没有办法在不发送的情况下在远程机器上运行 python 脚本?

multithreading - 通过 golang 进行 gitlab 抓取的问题