为什么连接到gitlab不工作(而http推和克隆工作正常)?

我在旧电脑上运行一个x86扩展环,并安装了bitnami gitlab 5.3。

当试图在SSH模式下推送第一个主分支时,这是我的错误消息:

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

(它在http协议中使用gitlab web仪表盘凭证)

  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 key也在.ssh/authorized_keys
  4. authorized_keys也有适当的内容,对于每行:

     command= "/opt/gitlab/apps/" 
  5. 我也注意到,我不能用sudo -su git nano authorized_keys显示authorized_keys文件的内容,因为:

    用户不在sudoers文件中。

  6. sudo /opt/gitlab/apps/gitlab/gitlab-shell/bin/check为每个validation(gitlab api,acces,repo和/home/git/.ssh/authorized_keys文件返回ok (因为我已经在configuration中设置了。 yml gitlab_url: http ://myserver.com/gitlab(本地服务器IP地址)而不是http://loopbackaddress.com/gitlab )我注意到我有两个版本的gitlab-shell目录,一个在/opt和一个在/home ,我不知道这是否是适当的风度?

  7. 当我尝试一个ssh -Tv似乎SSH服务器甚至不接受我的密钥,无法validation,并最终返回«权限被拒绝»。
  8. 除了shd[number] : connection closed by IP address以外,/ shd[number] : connection closed by IP address文件中也没什么特别的。
  9. authorized_keys文件path在/etc/ssh/sshd_config文件(/home/git/.ssh/authorized_keys)中设置为正确的绝对URL
  10. 最后我无法用“bundle exec bin / rake”进行debugging,因为我无法让我的Ubuntu安装所有必需的软件包来执行bundle。

我几乎可以肯定,在authorized_keys文件中调用command="/opt/...../gitlab-shell" ,它可能是一个简单的ssh错误configuration或者是错误的

PS:使用git和HTTP protocole对于我的家庭服务器就足够了,但是gitlab仪表板的兴趣是通过在web表单中填写ssh密钥并使用ssh来轻松添加一个贡献者

我有下面的错误试图克隆通过SSH从新安装的gitlab回购:

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

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

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

检查ssh日志/var/log/auth.log,如果你发现错误:

 User git not allowed because account is locked 

然后编辑/etc/shadow并改变git:!: to git:*:

PS在我的情况下在CentOS 6.5它是/ var / log / secure和git:!!:

我有一个相同的错误。 搜索和尝试了很多方法。 它没有工作。 然后,我在这个网站找到答案[ http://georgik.sinusgear.com 1 。 它为我工作。

我的gitlab的版本是6.6.4。

做如下:

  1. 找到独角兽运行的端口:

sudo emacs /home/git/gitlab/config/unicorn.rb 滚动到#监听Unix域套接字和TCP端口,发现:listen“127.0.0.1:port”,::tcp_nopush => true

  1. 编辑config.yml

sudo emacs /home/git/gitlab-shell/config.yml 改变gitlab_url:“你的域名”

gitlab_url:“127.0.0.1:[port]”

重新启动gitlab

sudo服务gitlab停止

sudo服务gitlab启动

检查.ssh文件夹的权限。

作为git用户登录并设置

 sudo su - git chmod 700 ~/.ssh chmod 600 ~/authorized_keys 

如果还有问题,请使用ssh的详细输出获取更多信息

 ssh -v ssh -T git@my-server.com 

(如果selinux启用并执行,也可能是selinux环境问题,请参阅此博客 )

我需要将我的公钥添加到/home/git/repositories/.ssh/authorized_keys。 /home/git/.ssh中的authoried_keys似乎不被使用。

  1. 将您的公钥添加到authorized_keys

     cat id_rsa.pub >> /home/git/repositories/.ssh/authorized_keys 
  2. 确保git是文件的所有者

     chown git /home/git/repositories/.ssh/authorized_keys 
  3. 确保组是git

     chgrp git /home/git/repositories/.ssh/authorized_keys 
  4. 设置文件模式位

     chmod 600 /home/git/repositories/.ssh/authorized_keys