【问题标题】:why my git can't push to my server by gitolite use git-daemon为什么我的 git 不能通过 gitolite 推送到我的服务器使用 git-daemon
【发布时间】:2012-09-11 18:08:24
【问题描述】:

当我使用 gitolite 时,忽略 git-daemon,我可以像 git clone git://xxx/xxx 那样做,但是当我推送项目时,它显示错误:

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)

但是,当我像git@xxx:xxx.git 一样使用ssh 时,它不仅可以克隆,还可以推送,但我想使用git:// 进行克隆和推送,那么我该怎么做才能让它工作呢?

【问题讨论】:

    标签: git gitolite git-daemon


    【解决方案1】:

    诀窍是,如果你正在克隆一个由 gitolite 管理的 git repo,那么远程 repo 将包含一个 post-update 钩子 (reserved by Gitolite),它应该由 gitolite 调用。

    通常,您应该能够使用本机 git 协议进行推送,前提是用户“守护程序”(see syntax,请参阅“Interfacing with git-daemon”对于 GitoliteV3)将 repo 声明为可读)

    repo @all
        R   =   gitweb daemon
    

    特殊用户daemon 可读的任何repo 都被视为git-daemon 可读。
    对于这些存储库中的每一个,都会在存储库中创建一个名为 git-daemon-export-ok 的空文件(即 $HOME/repositories 中的 repo.git 目录)。

    因此请检查您的 gitolite.conf 文件是否确实提到了用户 daemon,以及文件 $HOME/repositories/git-daemon-export-ok 是否存在。

    【讨论】:

    • 但是我想用gitolite和git-daemon,所以可以gitolite v3集成git-daemon,让git://可以做push,不只能clone?
    • @user1683012 我已经编辑了我的答案以满足您的具体要求。
    • 我在 /home/git/repositories/qianfuzi 和 gitolite-admin/conf/gitolite.conf 中触摸 git-daemon-export-ok 是 Repo qianfuzi WR+ = daemon,它可以克隆 git:/ /www.xxx.com/qianfuzi 但无法推送,现在使用你的方法,如 repo @all R = gitweb daemon 并将 git-daemon-export-ok 放入存储库中,它无法克隆和推送,当我克隆时它,错误是致命的:远程错误:访问被拒绝或存储库未导出:/qianfuzi,我该怎么办,谢谢
    • @user1683012 git-daemon-export-ok 必须由 gitolite 本身产生。尝试使用新的 gitolite 安装和一个测试 git repo 对其进行测试,以查看该文件是否正确生成。
    • Think You VonC,我试过了,但它不起作用,并得到同样的错误,我的上帝,太麻烦了
    猜你喜欢
    • 2023-02-06
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-04-07
    • 2012-11-25
    • 1970-01-01
    • 2015-03-14
    • 2017-01-25
    相关资源
    最近更新 更多