为什么与gitlab的ssh连接不起作用(而http push和clone可以正常工作)? [英] Why does ssh connection to gitlab not work (while http push and clone work fine)?

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

问题描述

我在旧电脑上运行了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模式推送第一个master分支时,这是我的错误消息:

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 Web仪表板凭据一起用于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. 对于每行,
  5. 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会为每个验证(gitlab api,acces,repo和/home/git/.ssh/authorized_keys文件)返回ok(因为我已在config.yml gitlab_url中设置为: 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错误配置,或者是在authorized_keys文件中调用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:对于我的家庭服务器,使用git和HTTP协议就足够了,但是gitlab仪表板的兴趣在于通过在Web表单中填充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

    推荐答案

    尝试从新安装的gitlab通过ssh克隆回购协议时遇到以下错误:

    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:!: to git:*:

    P.S. 就我而言,在CentOS 6.5上是/var/log/secure和git:!!:

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

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

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