简体   繁体   English

git 挂钩未在 Mac Monterey 中运行

[英]git hook not running in Mac Monterey

I have a pre-commit hook that is not running.我有一个未运行的预提交挂钩。 I already tried with different shebangs:我已经尝试过不同的 shebangs:

#!/usr/bin/env zsh
# tried:
#/bin/zsh
#/bin/sh
#/usr/bin/bash
#/usr/bin/zsh
#/usr/bin/sh
#/usr/bin/env
#/usr/bin/env zsh
#/usr/bin/env bash
#/usr/bin/env sh

I tried giving it permission with我试着给它许可

chmod ug+x .git/hooks/*

The hook has no extension as requested.钩子没有按要求延长。 after I try git commit nothing happens other than the usual "files changed, etc" text在我尝试 git 提交之后,除了通常的“文件已更改等”文本外,什么也没有发生

So, It worked once I moved it to /.githooks folder instead of .git/hooks .因此,一旦我将它移至/.githooks文件夹而不是.git/hooks ,它就起作用了。 The issue was that my core.hooksPath was pointing to /.githooks问题是我的core.hooksPath指向/.githooks

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM