Fez Vrasta
Fez Vrasta

Reputation: 14825

GitLab and SSH/HTTP connection

I've just set up an Ubuntu 64bit server dedicated to GitLab.

I have successfully installed GitLab and everything seems to work except for the SSH connection using a Git client ( SmartGit ).

I click on "Clone", then I insert the ssh git URL:

[email protected]:root/firstproject.git

When I click on "Next" it gives me this error:

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.

I have tried to generate an SSH key and put it in /home/git/.ssh/config but the problem remains the same.
I've even added it as "key" using the Gitlab control panel from web browser.

I have tried to restart GitLab and SSH but it didn't help. The HTTP method works, but gives me an error if I commint&push lot of files at the same time:

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)

I don't need to fix both problems, I just need to have one of them fully working.

Upvotes: 3

Views: 11709

Answers (2)

Ash Wilson
Ash Wilson

Reputation: 24458

From the stack trace, it looks like gitlab-shell can't resolve the server's own hostname in DNS to verify repository permissions with GitLab's web API. Try logging into the server and running:

nslookup mydomain.test

Where "mydomain.test" is the hostname you're using in the gitlab_url: setting in gitlab.yml. If you see an error like ** server can't find mydomain.test in the output, this is your problem.

If so, you can fix this by either:

  1. Correcting the DNS configuration of your server by editing /etc/resolv.conf so that it can resolve your hostname properly. The DNS servers you need to add depend on your hosting environment; you'll have to talk to someone who administers your network to find the proper values.
  2. Changing gitlab_url to use http://localhost/ instead of the externally-routable domain name.
  3. Adding an entry to /etc/hosts on your server for mydomain.test that points to 127.0.0.1.

Upvotes: 2

VonC
VonC

Reputation: 1324228

Make sure this isn't a configuration issue, as reported in issue 3324:

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

and change:

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

Slash at the end is important.

Upvotes: 0

Related Questions