Why i can use git-daemon serve my git repo?

5.5k Views Asked by At

There are some git bare repo in /home/git/repositories dir.
I use git-daemon-run serve git protocol to access these repos.
For example /home/git/repositories/root/spider.git is a bare git repo.

This is command ps -ef | grep git result.

120       9638  1062  0 10:44 ?        00:00:00 /usr/local/libexec/git-core/git-daemon --verbose --reuseaddr --base-path=/home/git/repositories --export-all --max-connections=64 -- /home/git/repositories

When I exec git clone git://hostname/root/spider.git, I get :

Cloning into 'spider'...
fatal: remote error: access denied or repository not exported: /root/spider.git

I check the syslog /var/log/git-daemon/current, I get :

2013-03-08_02:56:02.42145 [9698] Connection from 127.0.0.1:60080
2013-03-08_02:56:02.42149 [9698] Extended attributes (22 bytes) exist <host=hostname>
2013-03-08_02:56:02.42186 [9698] Request upload-pack for '/root/spider.git'
2013-03-08_02:56:02.42189 [9698] '/home/git/repositories/root/spider.git' does not appear to be a git repository
2013-03-08_02:56:02.42221 [9638] [9698] Disconnected (with error)
3

There are 3 best solutions below

4
On BEST ANSWER

From the error message, double check your path and make sure you did a

cd /home/git/repositories/root/
git init --bare spider

If that repo already existed, but directly in '/home/git/repositories', then you would need to adapt your git clone command:

 git clone git://hostname/spider.git

Finally, make sure the process git-daemon has the right to access the repository.

The account running the git-dameon must be able to access /home/git/repositories/root/sipder.git.

1
On

Add --enable=receive-pack to the git daemon command line, to enable send-pack (manual) support. You will then need to git reset --hard.

1
On

Create a empty file called git-daemon-export-ok in the repo dir.