gitolite hook for specific repository

前端 未结 2 497
轻奢々
轻奢々 2021-02-02 18:16

I don\'t understand how do I create a post-receive hook for a specific repository in gitolite (non-root install)

My bare repository contains a website t

2条回答
  •  借酒劲吻你
    2021-02-02 18:29

    Update July 2013: what follows is for gitolite V2 (or 'g2'), which was the version used by the OP at the time (November 2011).

    Update August 2013, with the latest gitolite 3.x: You now have official specific repo hook:

    it's basically just creating a symlink in /hooks pointing to some file inside $rc{LOCAL_CODE}/hooks/repo-specific (except the gitolite-admin repo)


    All hooks in gitolite/hooks/common are replicated in all repositories managed by Gitolite, as detailed in the hook propagation documentation.
    That means your hook script must take specific action depending on the repo which execute said hook.

    You can either use the $GL_REPO variable (which gitolite set and pass to all its scripts for any git command it receives).

    Or you can use some git configuration registered on the gitolite server, like the mirroring hook does. See the post-receive.mirrorpush hook.

    The OP Eyal R adds in the comments:

    But I still don't understand how it is done (I understand that $GL_REPO is used to determine which repo I am updating but I'm missing the practical part).
    I have created a file called post-receive.test with echo "test", put it in $HOME/gitolite/hooks/common, ran gl-setup, ran push from workstation - nothing happens (no "test" output)

    To which I replied:

    The hook should appear in the hook directory of your repo on the gitolite server as a link, linking back to the .gitolite/common/hook. Note that it should be in $HOME/.gitolite/common/hook, not /gitolite.

    The OP confirms the missing dot was the issue.

    The process to add an hook is detailed in Hook propagation in gitolite, and their usage in "Using Hooks".

提交回复
热议问题