Every so often when I try to clone or pull a Git repository from my private hosted Gitlab server I get an error stating that the name or host could not be resolved.

I figured this was because a DNS lookup failed so I tried to run nslookup privategitlab.here.com to check for any errors. Strangely enough the domain is correctly resolved. If I try to clone/pull after that it does work without errors.

I have managed to see an error with nslookup once. It stated it could not resolve the DNS using the Google name server ( with the error SERVFAIL. But when I ran nslookup again it did started to work again.

How can a DNS lookup seemingly fail at random?

I have noticed this error only on my Digital Ocean servers. When using Azure this error does not happen.

In both cased I used Ubuntu 14.04 x64.

1 Answer 1


It's possible that one of the DNS servers in your list of available DNS servers is either responding wrong or not at all, or the primary DNS servers for the domain name you're using are suffering in some way. As much as we like to think that DNS fails over nicely if something goes wrong, that's rarely the case.

Another possible cause is severe latency doing DNS lookups on your network, even to Google's server. If it fails the first try, then returns the second try, that's a good indication that your DNS server was too slow getting an answer and couldn't respond until it had cached it.

So basically it could be your local DNS servers, your host's DNS servers or you may have a bad entry in your resolv.conf file that points to a DNS server that no longer exists.

  • Hi Tony, thank you for your response. Do you know if there is any way to better debug these problems (e.g. see the response time from a DNS server)?
    – Mathyn
    Commented Apr 28, 2016 at 8:14
  • 1
    Quick update: I managed to solve the problem. It seemed to be a problem on Googles side as the company I registered the domain name also had problems resolving the domain name using Google. I updated /etc/network/interfaces to use OpenDNS instead of Google and it now seems to work!
    – Mathyn
    Commented Apr 28, 2016 at 14:47
  • Glad to know you figured out exactly where it was.
    – Tony Maro
    Commented Apr 30, 2016 at 15:55

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .