在gitolite钩子中的shebang问题

5

我有Ubuntu:

Distributor ID: Ubuntu
Description:    Ubuntu 15.10
Release:        15.10
Codename:       wily

以及gitolite:

gitolite3 3.6.3-1 (Debian) on git 2.5.0

我在配置文件中有以下几行:

repo    livesearch
    option hook.post-receive = livesearch
    RW+         = @commonwrite
    R           = @commonread

请跟随gitolite-admin/local/hooks/repo-specific/livesearch文件中的数据:

#!/bin/sh
/bin/sh /var/lib/gitolite3/.gitolite/local/hooks/repo-specific/common seofilters

如果我用这样的钩子文件提交到livesearch仓库,会得到以下结果:
remote: hooks/post-receive: 18: hooks/post-receive: hooks/post-receive.h00-livesearch: not found

但是!!!当我从文件中排除了shebang(#!/bin/sh)后,一切都正常工作了!!!
在两种情况下,我都在远程拥有:
lrwxrwxrwx 1 git www-data   65 Apr 13 13:23 post-receive.h00-livesearch -> /var/lib/gitolite3/.gitolite/local/hooks/repo-specific/livesearch

链接没问题!

另外,我有其他钩子,可以正常与 shebang 配合使用!
只是新的钩子不能与 shebang 配合使用,但我没有更新什么…

问题可能出在哪里呢?

1个回答

1
我建议在评论中尝试比较那些能够正常工作的钩子与不正常工作的钩子的正确性和编码或者行尾符。
也许有问题的那个在 shebang 之后有一个 CRLF。
原帖作者确认 shebang 行末存在 EOL 问题。

但这是由gitolite自动完成的。我没有手动操作过它。 - Olga Pshenichnikova
1
此外,尝试比较正常工作的钩子与不正常工作的钩子的正确编码或行尾符。 - VonC
1
也许有问题的那个在 shebang 后面有 CRLF? - VonC
你能回答我的问题吗?我会将其标记为正确答案。 - Olga Pshenichnikova
@Olga 我已经重写了答案。 - VonC
显示剩余2条评论

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接