Git -daemon: "it is not possible to allocate any sockets for listening on the host server (null) 9418"

When compressing Debian, I get a syslog error:

unable to allocate any listen sockets on host (null) port 9418 

And I also cannot clone remotely.

File /etc/service/git-daemon/run :

 "$(git --exec-path)"/git-daemon --verbose --base-path=/var/cache/git --detach --syslog --reuseaddr --export-all 

netstat -l | grep git netstat -l | grep git output:

 tcp 0 0 *:git *:* LISTEN tcp6 0 0 [::]:git [::]:* LISTEN 

I am currently restarting the sv start/stop command line services and killing the maintenance process to ensure it reboots.

Maybe I'm missing something really stupid. Any help is greatly appreciated.

+4
source share
3 answers

I think when you use the --listen git-daemon option, it will not complain about the lack of host ...

+1
source

Such a problem is a good match to remind ourselves that git daemon comes with options:

 --init-timeout=<n> 

The timeout (in seconds) between the moment the connection is established and the receipt of the client’s request (usually this is a rather low value, as this should be mostly immediate).

 --timeout=<n> 

Timeout (in seconds) for specific client requests.
This includes the time it takes the server to process the subquery and the time that it waits for the next client request.

This ensures that the socket will be available for hosting instead of supporting it for a client that may not exist.

git 2.9.x + (Q3 2016) will detect these cases faster:

See commit a43b68a (May 25, 2016) Eric Wong ( ele828 ) .
(the merger of Junio ​​C Hamano - gitster - to commit a43b68a , May 25, 2016)

daemon : enable SO_KEEPALIVE for all sockets

When " git daemon " starts without --[init-]timeout , a connection to a client that is quietly going offline can take a long time, wasting resources .
The KEEPALIVE socket level was turned on to allow the OS to notice such failed connections.

As long as the --init-timeout and --timeout options --init-timeout , and I never run git daemon without them, some users may forget to install them and encounter daemon processes when the connections fail.

Enable socket level timeouts so that the kernel can send keepalive probes needed to detect failed connections.

+1
source

Compare with setting up the git daemon, it might be simpler:

  • For a public repository, put it on github
  • For a private repository, configuring sshd / ssh is easy.

The problem also occurred once on my server.

There are two ways to use when a clone from git: // ... cannot work.

1, git by ssh, add the public key of the user to ~ / .ssh / authorized_keys, then the username / password is not required to access the repository:

 git clone user@host :/path/to/git/repository/myproject.git 

2, pust the repository in the web server access directory, for example

 /var/www/git 

Make sure that / var / www / is accessible, for example, it is installed as apache httpd doc root. This will allow the user to get at least.

0
source

All Articles