1

I am trying to run git daemon using launchd (on demand, inited style).

But git clone git clone git://127.0.0.1/testrepo fails with

Cloning into 'testrepo'...
fatal: unable to connect to 127.0.0.1
127.0.0.1[0: 127.0.0.1]: errno=Connection refused

It works fine without onDemand flag.

I am using following plist for launchd.

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>Label</key>
    <string>org.git.daemon</string>
    <key>OnDemand</key>
    <true/>
    <key>ProgramArguments</key>
    <array>
        <string>/usr/local/git/bin//git</string>
        <string>daemon</string>
        <string>--base-path=/apath/path</string>
        <string>--inetd</string>
        <string>--export--all</string>
        <string>--verbose</string>
    </array>
    <key>RunAtLoad</key>
    <false/>
    <key>ServiceDescription</key>
    <string>Git server</string>
    <key>Sockets</key>
    <dict>
        <key>Listeners</key>
        <dict>
            <key>SockFamily</key>
            <string>IPv4</string>
            <key>SockServiceName</key>
            <string>9418</string>
            <key>SockType</key>
            <string>dgram</string>
        </dict>
    </dict>
    <key>UserName</key>
    <string>git</string>
    <key>inetdCompatibility</key>
    <dict>
        <key>Wait</key>
        <false/>
    </dict>
</dict>
</plist>
2
  • 1
    I am not sure if dgram is right in this context.
    – cstamas
    Feb 24, 2013 at 11:45
  • You are right. It should have been stream.
    – shakthi
    Feb 24, 2013 at 17:25

1 Answer 1

1

I finally solved this with following configuration.

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>Label</key>
    <string>org.git.daemon</string>
    <key>OnDemand</key>
    <true/>
    <key>ProgramArguments</key>
    <array>
        <string>/usr/local/git/bin/git</string>
        <string>daemon</string>
        <string>--base-path=/Volumes/Development/GitRepos</string>
        <string>--inetd</string>
        <string>--export-all</string>
        <string>--verbose</string>
        <string>--informative-errors</string>
    </array>
    <key>RunAtLoad</key>
    <false/>
    <key>ServiceDescription</key>
    <string>Git server</string>
    <key>Sockets</key>
    <dict>
        <key>Listeners</key>
        <dict>
            <key>SockFamily</key>
            <string>IPv4</string>
            <key>SockServiceName</key>
            <string>9418</string>
            <key>SockType</key>
            <string>stream</string>
        </dict>
    </dict>
    <key>UserName</key>
    <string>git</string>
    <key>inetdCompatibility</key>
    <dict>
        <key>Wait</key>
        <false/>
    </dict>
</dict>
</plist>

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .