GitLab和SSH / HTTP连接

时间:2013-10-26 10:39:35

标签: git ssh gitlab

我刚刚设置了一个专用于GitLab的Ubuntu 64位服务器。

我已经成功安装了GitLab,除了使用Git客户端(SmartGit)的SSH连接外,一切似乎都有效。

我点击"克隆",然后插入ssh git网址:

git@mydomain.test:root/firstproject.git

当我点击"下一步"它给了我这个错误:

Please check the repository URL.

Could not read from remote repository.: /user/local/lib/ruby/2.0.0/net/http.rb:878:in 'initialize': getaddrinfo: Name of service not know (SocketError)
from /user/local/lib/ruby/2.0.0/net/http.rb:878:in 'open'
from /user/local/lib/ruby/2.0.0/net/http.rb:878:in 'block in connect'
from /user/local/lib/ruby/2.0.0/net/http.rb:878:in 'timeout'
from /user/local/lib/ruby/2.0.0/net/http.rb:878:in 'connect'
from /user/local/lib/ruby/2.0.0/net/http.rb:878:in 'do_start'
from /user/local/lib/ruby/2.0.0/net/http.rb:878:in 'start'
from /user/local/lib/ruby/2.0.0/net/http.rb:878:in 'get'
from /user/local/lib/ruby/2.0.0/net/http.rb:878:in 'allowed?'
from /user/local/lib/ruby/2.0.0/net/http.rb:878:in 'validate_access'
from /user/local/lib/ruby/2.0.0/net/http.rb:878:in 'exec'
from /user/local/lib/ruby/2.0.0/net/http.rb:878:in '<main>'
Please make sure you have the correct access rights and the repository exists.

我试图生成一个SSH密钥并将其放在/home/git/.ssh/config中,但问题仍然存在 我甚至把它添加为&#34; key&#34;使用Web浏览器中的Gitlab控制面板。

我试图重启GitLab和SSH,但它没有帮助。 HTTP方法有效,但如果我同时发送和推送大量文件,则会出错:

The remote end hung up unexpectedly
The remote end hun up unexpectedly
RPC failed; result=22, HTTP code = 411

Counting objects: 89, done
Delta compression using up to 8 threads.
Total 88 (delta 12), reused 0 (delta 0)

我不需要解决这两个问题,我只需要让其中一个完全正常工作。

2 个答案:

答案 0 :(得分:2)

从堆栈跟踪看起来,gitlab-shell无法解析DNS中服务器自己的主机名,无法使用GitLab的Web API验证存储库权限。尝试登录服务器并运行:

nslookup mydomain.test

其中“mydomain.test”是您在gitlab_url:的{​​{1}}设置中使用的主机名。如果您在输出中看到类似gitlab.yml的错误,那么这就是您的问题。

如果是这样,您可以通过以下方式解决此问题:

  1. 通过编辑/etc/resolv.conf来纠正服务器的DNS配置,以便它可以正确解析您的主机名。您需要添加的DNS服务器取决于您的托管环境;你必须与管理网络的人交谈才能找到合适的价值。
  2. ** server can't find mydomain.test更改为使用gitlab_url而不是外部可路由的域名。
  3. 在服务器上为http://localhost/添加指向127.0.0.1的mydomain.test条目。

答案 1 :(得分:0)

确保这不是配置问题,如issue 3324中所述:

sudo -u git -H vim /home/git/gitlab-shell/config.yml
     

并改变:

gitlab_url: http://yourhost to gitlab_url: http://yourhost/
     

最后的抨击很重要。