为什么 ssh 连接到 gitlab 不起作用(而 http 推送和克隆工作正常)? [英] Why does ssh connection to gitlab not work (while http push and clone work fine)?

查看:22
本文介绍了为什么 ssh 连接到 gitlab 不起作用(而 http 推送和克隆工作正常)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在一台旧电脑上运行 x86 raring ringtail 并安装了 bitnami gitlab 5.3.

I run a x86 raring ringtail on a old pc and having installed bitnami gitlab 5.3.

这是我在尝试以 SSH 模式推送第一个主分支时的错误消息:

Here is my error msg when trying to push the first master branch in SSH mode:

fatal: Could not read from remote repository.
Please make sure you have the correct access rights and the repository exists.

(它在带有 gitlab 网络仪表板凭据的 http 协议中工作)

(it works in http protocol with the gitlab web dashboard credentials)

  1. 我已经使用 root 用户启动了 bitnami-installer.run,所以我认为所有文件都进入 /opt 而不是 /home(这是个好程序吗?)
  2. 我在安装 GitLab 之前没有 git 用户,因为我听说它可能会混淆 .ssh/authorized_keys 文件和其他权限.
  3. 当我运行 ssh -T git@my-server.com 它说 permission denied (public key) 但我客户端计算机上的 pub 密钥也在 <代码>.ssh/authorized_keys?
  4. authorized_keys 也有正确的内容,每一行都有:

  1. I have launched bitnami-installer.run with root user so I think all the files went in /opt instead of /home (this was the good procedure?)
  2. I didn't have a git user before installing GitLab since I heard it could make a confusion in the .ssh/authorized_keys files and other permissions.
  3. When I run ssh -T git@my-server.com it says permission denied (public key) but the pub key on my client computer is also in .ssh/authorized_keys?
  4. authorized_keys has the proper content also, with for each line:

command= "/opt/gitlab/apps/"

  • 我还注意到我无法使用 sudo -su git nano authorized_keys 显示 authorized_keys 文件的内容,因为:

  • I have also noticed that I cannot display the content of authorized_keys file with a sudo -su git nano authorized_keys because:

    用户不在 sudoers 文件中.

    the user is not in the sudoers file.

  • 但是 sudo/opt/gitlab/apps/gitlab/gitlab-shell/bin/check 为每个验证返回 ok (gitlab api, accesses, repo和 /home/git/.ssh/authorized_keys 文件(因为我已在 config.yml gitlab_url 中设置为:http://myserver.com/gitlab(本地服务器 IP 地址)而不是 http://loopbackaddress.com/gitlab).我注意到我有两个版本"的 gitlab-shell 目录,一个在 /opt 和一个在 /home 和不知道是不是得体的举止?

  • But sudo /opt/gitlab/apps/gitlab/gitlab-shell/bin/check returns ok for each verification (gitlab api, acces, repo and /home/git/.ssh/authorized_keys file (because i have set in th config.yml gitlab_url to : http://myserver.com/gitlab (local server ip address) instead of http://loopbackaddress.com/gitlab). I have noticed that i have « two versions » of the gitlab-shell directory, one in /opt and one in /home and i don't know if it it is the appropriated demeanor ?

    我几乎可以肯定这要么是简单的 ssh 配置错误,要么是在调用授权密钥文件中的 command="/opt/...../gitlab-shell" 时出现问题

    I am almost sure it's either a simple ssh misconfiguration or something wrong when invoking the command="/opt/...../gitlab-shell" in the authorized_keys file

    PS:对于我的家庭服务器来说,使用带有 HTTP 协议的 git 就足够了,但 gitlab 仪表板的兴趣是通过在 Web 表单中填写 ssh 密钥并在之后使用 ssh 来轻松添加贡献者

    PS: using git with HTTP protocole would be enough for my home server but the interest of the gitlab dashboard is to easily add a contributors by filling the ssh key in the web form and using ssh after

    推荐答案

    我在尝试通过 ssh 从新安装的 gitlab 克隆 repo 时遇到以下错误:

    I've got the following error trying to clone repo via ssh from freshly installed gitlab:

    致命:无法从远程存储库读取.

    fatal: Could not read from remote repository.

    请确保您拥有正确的访问权限和存储库存在.

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

    https://github 找到了解决方案.com/gitlabhq/gitlab-public-wiki/wiki/Trouble-Shooting-Guide#ssh

    检查 ssh 日志/var/log/auth.log 是否发现错误:

    Check ssh log /var/log/auth.log and if you find error:

    User git not allowed because account is locked
    

    然后编辑 /etc/shadow 并将 git:!: 更改为 git:*:

    附:在我的 CentOS 6.5 上,它是/var/log/secure 和 git:!!:

    P.S. In my case on CentOS 6.5 it was /var/log/secure and git:!!:

    这篇关于为什么 ssh 连接到 gitlab 不起作用(而 http 推送和克隆工作正常)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

  • 查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆