why my git can't push to my server by gitolite use git-daemon

2.5k Views Asked by At

when I use gitolite, ignoring git-daemon, I can do like git clone git://xxx/xxx,but when I push the project, it shows me the error:

Total 2 (delta 0), reused 0 (delta 0)
remote: Empty compile time value given to use lib at hooks/update line 6
remote: Use of uninitialized value in require at hooks/update line 7.
remote: Can't locate Gitolite/Hooks/Update.pm in @INC (@INC contains:  /usr/local/lib64/perl5 /usr/local/share/perl5 /usr/lib64/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib64/perl5 /usr/share/perl5 .) at hooks/update line 7.
remote: BEGIN failed--compilation aborted at hooks/update line 7.
remote: error: hook declined to update refs/heads/master
To git://www.54cxy.com/qianfuzi
 ! [remote rejected] master -> master (hook declined)

However, when I use ssh like git@xxx:xxx.git it worked not only can clone, but also can push, but I want to use git:// to clone and push, so what I can do for it to work?

1

There are 1 best solutions below

6
On

The trick is, if you are cloning a git repo managed by gitolite, that remote repo will contain a post-update hook (reserved by Gitolite), which is supposed to be called by gitolite.

Normally, you should be able to push with the native git protocol, provided the repo is declared as readable by the user 'daemon' (see syntax, and see "Interfacing with git-daemon" for GitoliteV3)

repo @all
    R   =   gitweb daemon

Any repo readable by the special user daemon is deemed to be readable by git-daemon.
For each of these repos, an empty file called git-daemon-export-ok is created in the repository (i.e., the repo.git directory inside $HOME/repositories).

So check if your gitolite.conf file does mention the user daemon, and if the file $HOME/repositories/git-daemon-export-ok is there.