Git 挂钩权限被拒绝

Sus*_*mit 3 git githooks ubuntu-20.04

当我尝试运行时,git commit -m 'message here'出现以下错误。

fatal: cannot exec '.git/hooks/prepare-commit-msg': Permission denied

当我在 ubuntu 上创建一个新分区并在其中克隆存储库后,这个问题就开始了。

and*_*lrc 9

您需要使您的文件可执行,下面的代码片段将使文件对所有者、组和世界可执行:

$ chmod +x .git/hooks/prepare-commit-msg
Run Code Online (Sandbox Code Playgroud)

  • 该消息是后来在2.14.3 https://github.com/git/git/commit/f805a00a396ee91599902cebe55620b2a4c813b9中添加的 (3认同)
  • @fluffy我可以看到在2.13中引入了对非可执行文件的检查,请参阅提交https://github.com/git/git/commit/940283101ce87250cf31a592730386f5061e1286我不确定OP正在运行哪个版本。 (2认同)