Search code examples
gitgithooks

git hook not running in Mac Monterey


I have a pre-commit hook that is not running. I already tried with different 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


Solution

  • So, It worked once I moved it to /.githooks folder instead of .git/hooks. The issue was that my core.hooksPath was pointing to /.githooks