15

I typed the command to have a connection test to github:

ssh -T git@github.com

but it outputs:

ssh: Could not resolve hostname github.com: nodename nor servname provided, or not known

why ssh could not resolve github.com? I want to know this and how to solve it?

theonlygusti
  • 11,032
  • 11
  • 64
  • 119
Edlin
  • 301
  • 1
  • 3
  • 6

1 Answers1

22

Check your network or dns config (as in this question).
"git and ssh: Could not resolve hostname, ping works" mentions:

This sounds like a DNS issue. Try switching to another DNS server and see if it works.

OpenDNS

    208.67.222.222
    208.67.220.220

GoogleDNS

    8.8.8.8
    8.8.4.4

If ssh still gives you hard time, try switching to https.


The OP Edlin confirms in the comments that switching DNS works, and recommend for Mac OS X users the How-to Geek article "How to Switch Mac OS X to Use OpenDNS or Google DNS":

  • System Preferences…
  • click on the Network icon…
  • select your network card on the left and then select the Advanced button near the bottom right corner.
  • switch over to the DNS tab, and you can start adding in DNS entries into the list.
    Click the + symbol at the bottom to add new ones:

http://www.howtogeek.com/geekers/up/sshot4d0b1298a026e.jpg

Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • Jesus! It works. Thanks you! And here is a link about [How to Switch Mac OS X to Use OpenDNS or Google DNS](http://www.howtogeek.com/howto/38793/how-to-switch-mac-os-x-to-use-opendns-or-google-dns/). It may help someone who need it. – Edlin Feb 01 '14 at 15:05
  • @Edlin Excellent. I have referenced and illustrated in the answer the link you mention for more visibility. – VonC Feb 01 '14 at 17:07