Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SSH connect to github fail

Tags:

github

ssh

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

ssh -T [email protected]

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?

like image 999
Edlin Avatar asked Jan 31 '14 19:01

Edlin


People also ask

How do I fix my SSH key in GitHub?

In terminal enter this command with your ssh file name pbcopy < ~/. ssh/id_rsa. pub This will copy the file to your clipboard Now open you github account Go to Settings > SSH and GPG keys > New SSH key Enter title and paste the key from clipboard and save it. Voila you're done.

How do I connect SSH key to GitHub?

Login to github.com and bring up your account settings by clicking the tools icon. Select SSH Keys from the side menu, then click the Add SSH key button. Name your key something whatever you like, and paste the contents of your clipboard into the Key text box. Finally, hit Add key to save.


1 Answers

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

like image 92
VonC Avatar answered Sep 28 '22 20:09

VonC