我正在使用yorkie 2.0.0,并且不能在我的git钩子中运行任何自定义的shell脚本。我的目录结构如下所示:
<project root>
|-- .githooks
| |-- commit-msg
|
|-- package.json
|-- .git
| |-- hooks
| | |-- <all the proper yorkie git hooks files>
| |
| |-- <other .git stuff>
|
|-- <lots of other irrelevant files>我的package.json有这个gitHooks部分:
"gitHooks": {
"commit-msg": ".githooks/commit-msg $GIT_PARAMS"
}下面是ls -l行,commit-msg文件绝对是可执行的:
-rwxr-xr-x 1 dan dan 400 Sep 14 08:51 commit-msg当我创建一个commit时,我得到以下输出:
> running commit-msg hook: .githooks/commit-msg $GIT_PARAMS
/bin/sh: 1: .githooks/commit-msg: not found
commit-msg hook failed (add --no-verify to bypass)我尝试过各种不同的目录结构,但都没有找到。我已经将package.json中的gitHook脚本更改为类似于ls .githooks的内容,然后文件就会显示出来。
怎么一回事?为什么约克找不到我的档案?
(我给它加上了赫斯基标签,因为yorkie是赫斯基的一个分支,只有很小的变化,并且没有yorkie标签。这里的问题可能不是yorkie所特有的)
发布于 2019-09-14 21:23:11
结果发现not found是转移视线的。这是一个行尾问题。
在我将commit-msg内部的行尾转换为LF后,一切都正常了。我在.gitattributes中添加了下面这一行,这样就不会在每次检查分支时都发生这种情况:
.githooks/* text eol=lfhttps://stackoverflow.com/questions/57935923
复制相似问题