0

I'm trying to set up a git public repository for my team.

I have installed Git on a linux box (RedHat 5.6).

As a first step, i'm trying to configure Git to use the git protocol, by setting it up to run through xinetd.

Here's the contents of /etc/xinetd.d/git-daemon:

# default: off
# description: The git server offers access to git repositories
service git
{
        disable = no
        type            = UNLISTED
        port            = 9418
        socket_type     = stream
        wait            = no
        user            = nobody
        server          = /usr/bin/git/git
        log_type = FILE /var/log/git-daemon
        server_args     = daemon --verbose --inetd --export-all --base-path=/tmp
        log_on_failure  += USERID
}

According to /var/log/messages the service is started correctly.

When trying to clone a test (bare) repository, i am getting a failure:

C:\Users\ltal>git clone git://10.161.202.45/lior-test.git c:\liorssf
Cloning into c:\liorssf...
fatal: protocol error: bad line length character: fata

Running the same command that is configured for xinetd from the shell seems to work fine:

/usr/bin/git/git daemon --verbose --export-all --base-path=/tmp &

Now cloning works.

What am i doing wrong here? Can't seem to find a solution.

liortal
  • 101
  • 5

3 Answers3

1

"fata" is the beginning of "fatal", git clone truncates it, so you may directly try to use nc 10.161.202.45 9418 to get the full message returned by git daemon, then if this is not enough for you to fix it, you may temporarily replace /usr/bin/git by /usr/bin/strace in the server field of the xinetd config, and prepend -f /usr/bin/git to the server_args field. It's likely a permissions error, maybe you have a /.git/ own by root, and git daemon likely run as less privileged git user, chokes when trying to read /.git/config

julm
  • 21
  • 3
0

Maybe /usr/bin/git is not in the PATH.

Add env += GIT_TRACE=/tmp/git-xinetd.log into the /etc/xinetd.d/git-daemon and try again to see what does log say?

quanta
  • 51,413
  • 19
  • 159
  • 217
  • This just gives a trace of the command that runs: trace: exec: 'git-daemon' '--verbose' '--inetd' '--export-all' '--base-path=/tmp' trace: run_command: 'git-daemon' '--verbose' '--inetd' '--export-all' '--base-path=/tmp' – liortal Aug 17 '11 at 10:20
  • Also, running git from any directory i am in seems to work, so i don't believe this is a PATH issue. – liortal Aug 17 '11 at 10:21
  • Did you try `git clone` from client after adding? – quanta Aug 17 '11 at 10:30
  • What do you mean git clone from the client? The output i pasted here was the one displayed when i try to run git clone from my windows client box. – liortal Aug 17 '11 at 10:38
  • Your path may not be the same path that `xinetd` is operating with. That said, it appears that the daemon command is running appropriately. I think you may need to look at a lower level... I'd start confirming each step with external tools -- atop, wireshark, etc. Also, consider the possibility of a version mismatch. – Jeff Ferland Aug 17 '11 at 14:07
  • I mean after running `git clone` from your Windows, is there anything in `git-xinetd.log`. – quanta Aug 17 '11 at 14:18
  • I have fixed the original problem. I change the user from NOBODY to root (for now). this made it work. – liortal Aug 18 '11 at 07:35
0

The problem was with the user that i've used for setting up xinetd.

I changed this to be root (for now), and i can now happily clone the repository from other clients.

liortal
  • 101
  • 5