GitLab and SSH/HTTP connection

10,997

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.
Share:
10,997

Related videos on Youtube

Fez Vrasta
Author by

Fez Vrasta

Updated on June 04, 2022

Comments

  • Fez Vrasta
    Fez Vrasta almost 2 years

    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.

  • Fez Vrasta
    Fez Vrasta over 10 years
    the server can't neither resolve localhost... I've generated a new key with putty key generator, added the public key to the server, loaded the private key when asked in SmartGit, and now it don't gives error but continues asking the ssh key...
  • Fez Vrasta
    Fez Vrasta over 10 years
    Ok I have added to my DNS server a DNS rule to point to the IP of the Git server, and now the nslookup works correctly using "mydomain.test", but when I try to login it continues to ask me the ssh key...
  • Ralf Marmorglatt
    Ralf Marmorglatt over 10 years
    Are you being prompted for the password for your SSH key, or for a password for the server ([email protected]'s password:)? If it's the SSH key password, either the password is mistyped or the key is corrupted somehow; if it's the password for the server, it might be a problem with your ~git/.ssh/authorized_keys file.