After having this problem myself, I found a solution that works for me:
ssh -v email@example.com OpenSSH_5.8p1, OpenSSL 1.0.0d 8 Feb 2011 debug1: Connecting to github.com [18.104.22.168] port 22. debug1: connect to address 22.214.171.124 port 22: Connection timed out ssh: connect to host github.com port 22: Connection timed out ssh: connect to host github.com port 22: Bad file number
You will only see the bad file number message when on windows using the MINGGW shell. Linux users will just get Timed out.
SSH is probably blocked on port 22. You can see this by typing
$nmap -sS github.com -p 22 Starting Nmap 5.35DC1 ( http://nmap.org ) at 2011-11-05 10:53 CET Nmap scan report for github.com (126.96.36.199) Host is up (0.10s latency). PORT STATE SERVICE 22/tcp ***filtered*** ssh Nmap done: 1 IP address (1 host up) scanned in 2.63 seconds
As you can see the state is Filtered, which means something is blocking it.
You can solve this by performing an SSH to port 443 (your firewall / isp will not block this).
It is also important that you need to ssh to “ssh.github.com” instead of github.com.
Otherwise, you will report to the webserver instead of the ssh server.
Below are all the steps needed to solve this problem.
(First of all make sure you generated your keys like explained on http://help.github.com/win-set-up-git/)
create file ~/.ssh/config (ssh config file located in your user directory.
On windows probably
Paste the following code in it:
Host github.com User git Hostname ssh.github.com PreferredAuthentications publickey IdentityFile ~/.ssh/id_rsa Port 443
Save the file.
Perform ssh like usual:
$ssh -T github.com $Enter passphrase for key '.......... (you can smile now :))
Note that I do not have to supply the username or port number.