Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm trying to setup a git repository on an existing Windows 2008 (R2) server. I have successfully installed Cygwin & added git and ssh to the packages, and everything works perfectly (thanks to Mark for his article on it).

I can ssh to localhost on the server, and I can do git operations locally on the server. When I try to do either from the client, however, I get the "port 22, Bad file number" error. Detailed SSH output is limited to this:

OpenSSH_4.6p1, OpenSSL 0.9.8e 23 Feb 2007
debug1: Connecting to {myserver} [{myserver}] port 22.
debug1: connect to address {myserver} port 22: Attempt to connect timed out without establishing
        a connection
ssh: connect to host {myserver} port 22: Bad file number

Google tells me that this means I'm being blocked, usually, by a firewall. So, double-checked the firewall settings on the server, rule is there allowing port 22 traffic. I even tried turning off the firewall briefly, no change in behavior. I can ssh just fine from that client to other servers. The hosting company swears that there's no other firewalls blocking that server on port 22 (or any other port, they claim, but I find that hard to believe). I have another trouble ticket into them, just in case the first support person was full of it, but meanwhile I wanted to see if anyone could think of anything else it can be.

Thanks, Paul

share|improve this question

Windows Firewall on 2008 has three different profiles: private, public, and domain. Not sure if your server's on a domain, but I'd add an exception -- if you haven't already done so -- to the private, domain and public profiles in the firewall.

share|improve this answer
I do have exceptions for all three profiles already. Good idea, though. – Paul Apr 19 '10 at 21:32
up vote 1 down vote accepted

OK, well, turns out the first person I talked to at the hosting company was incorrect. The problem was, in fact, that they block port 22 by default to the section of their network that has Windows servers. I've applied for an exception to that policy.


share|improve this answer
Ah. It's so annoying when you bother to contact support, go through (the usually) hoops to get someone who knows what they're talking about, and then find out later that it was on their end. – gravyface Apr 19 '10 at 22:37

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.