Git Daemon (unable to connect to a socket)

I've got Git running on my Debian server and then installed git-daemon so that I can do public clones via the git protocol. The daemon is running, but whenever I do a clone it errors out:

$ git clone git://myserver.net/home/git/ehsa/omega_ehsa

Cloning into omega_ehsa…

electricjet.net[0: 66.228.55.188]: errno=Connection timed out

fatal: unable to connect a socket (Connection timed out)

If I run git daemon on the server I get:

$ git daemon

fatal: unable to allocate any listen sockets on port 9418

But yet everything appear to be listening properly:

$ sudo netstat -an | egrep 'Proto|LISTEN'

[sudo] password for tim:

Proto Recv-Q Send-Q Local Address Foreign Address State

tcp 0 0 0.0.0.0:9418 0.0.0.0:* LISTEN

tcp 0 0 0.0.0.0:3306 0.0.0.0:* LISTEN

tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN

tcp 0 0 0.0.0.0:25 0.0.0.0:* LISTEN

tcp6 0 0 :::9418 :::* LISTEN

tcp6 0 0 :::80 :::* LISTEN

tcp6 0 0 :::22 :::* LISTEN

tcp6 0 0 :::443 :::* LISTEN

I've been Googling for hours on this and am at a loss – anybody have an idea here?

4 Replies

Assuming that 66.228.55.188 is the right address for your Linode, do you have a firewall and if so is it configured to permit connections to the git daemon port? Your client is getting a timeout and not an immediate refusal. So it looks like the traffic is being blocked somewhere along the way, and probably is never reaching the git daemon.

The failure you get from trying to run git daemon manually is likely due to the existing daemon already listening on the port. If you add a "-p" onto the netstat you can verify which process is on which port.

– David

Okay, I'm getting closer but still stuck. It turns out that port 9418 was filtered by iptables. I created a new rule and it now is open:

$ nmap 66.228.55.188 -p 9418

Starting Nmap 5.21 ( http://nmap.org ) at 2011-07-28 03:26 CDT

Nmap scan report for li297-188.members.linode.com (66.228.55.188)

Host is up (0.044s latency).

PORT STATE SERVICE

9418/tcp open git

And now when I run a git clone I get a new error:

$ git clone git://myserver.net/home/git/ehsa/omega_ehsa

fatal: The remote end hung up unexpectedly

So, it appears I solved my original problem but am faced with a new one.

Any ideas to check?

Thanks a ton

> fatal: The remote end hung up unexpectedly Normally means authentication failed, have you enabled public access to that repo? Does the git daemon user have read access to the files?

Okay, I got it sorted:

The last problem (authentication) was caused by a bad path in my /etc/service/git-daemon/run file (which defaulted to /var/cache/git). Fixed my path and everything is finally running smoothly, thanks for the help.

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct