gpt4 book ai didi

hook - git push 后的 gitolite 钩子(Hook)不起作用

转载 作者:行者123 更新时间:2023-12-01 15:20:13 25 4
gpt4 key购买 nike

我试图搜索以找到解决方案。
但是,我不能。

我安装了gitolite。而且效果很好。
我可以在本地机器上 git clone,也可以更改 gitolite-admin repo。

但我想使用 gitolite Hook 。
遵循本手册

http://sitaramc.github.com/gitolite/hooks.html

custom hooks

You can supply your own, custom, hook scripts if you wish. Install gitolite as usual, then:

go to ~/.gitolite/hooks/common on the server and put your new hook there now run "gl-setup" again You can use this procedure to install new hooks as well as to update hooks that you had previously installed.



所以我试图 Hook 一些基本的shell脚本。

我把 bash shell 脚本放在
~/.gitolite/hooks/common

并将其命名为
update

更新脚本文件的所有者是 git,并且是可执行的。
shell脚本是这样的..
#!/bin/bash
touch /tmp/$GL_REPO

我执行
gl-setup mypubkey.pub

进而,
在我的本地 git 文件夹中,
我修改了一些文件, commitpush到 gitolite 服务器。
推送效果很好。每个文件上传到 gitolite 的仓库。
但是, Hook 似乎没有发生。没啥事儿。

在服务器的 tmp 目录中,没有创建文件。

我是不是忘记了什么?

任何评论请...

最佳答案

您应该意识到(来自您在问题中提到的“using hooks”页面=:

The update hook is used in all repos and is critical to gitolite's access control



换句话说,您不能直接使用“更新”脚本。
您必须使用 gitolite 的“ hook chaining”功能,以便在 gitolite 之后调用您自己的更新 Hook :

To run your own 'update' hook, just put it in a file called update.secondary and install it as a hook.
Gitolite's update hook will automatically chain to it, taking care to pass it the same 3 arguments the original update hook received from git.



最后, OP Jinbom Heo ,而不是使用“gitolite 钩链”,而是使用另一个钩子(Hook):

I put post-receive file in /var/gitolite/hooks/common/ folder. And it works.



文档“ Where do I put my hooks”建议将它们放在“用户”位置( ~/.gitolite/hooks/common)下:

hook place

但是系统位置也可以。

( /var/gitolite/hooks/common/ 意味着,顺便说一下,OP 选择了 root method installationpackage one ,默认路径为 /usr/local/bin/var/gitolite/conf/var/gitolite/hooks )

关于hook - git push 后的 gitolite 钩子(Hook)不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9678864/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com