2

From question: 'receive-pack': service not enabled for './.git'

it seems like the line

git daemon --reuseaddr --base-path=. --export-all --verbose --enable=receive-pack

is needed to start a git daemon? What is the cleanest command that can start a daemon?

I don't understand why such a long line is need to start the server, rather than just git server, just like rails using rails s to start a server. It will be silly for rails to start a server using

rails s --yes-make-it-public --yes-accept-http-request --base-directory=.
Community
  • 1
  • 1
nonopolarity
  • 146,324
  • 131
  • 460
  • 740

1 Answers1

2

It is very normal for servers to either need complex configuration files or a fair number of command line arguments. Typically, this is addressed by creating a a script with the launch options you want. You may also desire to put that script in a location which is launched by your server machine at startup (/etc/ini.td/...)

Jeff Ferland
  • 17,832
  • 7
  • 46
  • 76
  • is it more rare to want to start a server without "export-all" and without "enable receive pack"? (that's what a server is for, right? taking in request and able to provide data). If so, why doesn't it make them the default and make the opposite the special option or flags. – nonopolarity Apr 02 '11 at 01:12
  • receive-pack is actually used for writes and the git protocol does not authenticate users natively so its use is discouraged. As for whether you typically export-all, it depends perhaps on what you are doing! – Emil Sit Apr 02 '11 at 01:24
  • maybe there should be a command like `git server` just for making it good for cloning, pull, and push, without all these "special flags" – nonopolarity Apr 02 '11 at 01:31
  • That would mean that the default server command would allow anybody to connect to and write to your repository with no authentication. Your example of Ruby depends on complex code in the server's directory to tell it what to do. There is no parallel for git -- the server needs its rules from somewhere. Write it into a script and forget about it. – Jeff Ferland Apr 02 '11 at 01:37
  • You can also make an alias so when you type `git server`, it actually does the long command… – Simon Apr 02 '11 at 01:55
  • @動靜能量: I'd like to reinforce what others have said: those two options give you a completely unsecured, open server. It may be okay with a private network, but since it's so potentially dangerous, it can't be default. – Cascabel Apr 02 '11 at 05:24