Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free.

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

Just as in the title, why doesn't git daemon start the service in the background, since it's a "daemon", being a background process? I know that I can start it in the background using git daemon &, but I'm just wondering about the philosophical reason for this decision.

share|improve this question

closed as off-topic by Bart van Ingen Schenau, GlenH7, Jan Hudec, ozz, Kilian Foth Oct 14 '13 at 11:35

  • This question does not appear to be about software development within the scope defined in the help center.
If this question can be reworded to fit the rules in the help center, please edit the question.

You're likely looking for the --detach or --inetd options, which is fairly standard daemon options. – user40980 Oct 13 '13 at 10:40
Ah, thanks. Any reason why these aren't the default options? – eZanmoto Oct 13 '13 at 10:42
It is likely the least damaging of the options if you forget to include it at the wrong time. Consistency maybe too - everything else in git runs from a shell by default, why have just one that doesn't? Beyond that, one starts needing to read the source to see if there are comments around that code block or the original repository to get hints of the intent... or ask Linus directly. – user40980 Oct 13 '13 at 10:48
Thanks for that, your explanation makes sense and I was just looking for some rational behind the decision. Would you mind upgrading your comments to an answer, and I could select it as the correct one? Thanks for your time. – eZanmoto Oct 13 '13 at 10:51
This question appears to be off-topic because it is about an implementation issue but does not provide enough information to make the question answerable elsewhere. – GlenH7 Oct 14 '13 at 2:28
up vote 3 down vote accepted

The simplest answer is likely consistency. All of the other git subcommands are intended to be invoked from the shell. To have one subcommand work differently may surprise some people. Beyond this, its just a guess that may be found somewhere in the depths of the the mailing list, the comments on the code, the commits for the revisions, or the mind if Linus (in likely order of accessibility).

There are options for the git daemon subcommand that make it work better than appending an & after the command. From the documentation (note the examples of the starting options at the end):

--inetd Have the server run as an inetd service. Implies --syslog. Incompatible with --detach, --port, --listen, --user and --group options.

--detach Detach from the shell. Implies --syslog.

One might also want to look at the git-daemon tags on serverfault and stackoverflow for related setup help.

share|improve this answer

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