Problem
The Run git hooks option is not visible in the Commit settings, and pre-commit hooks placed in .git/hooks are not executed when committing from the IDE.
This occurs even when Settings | Advanced Settings | Version Control | Git | Do not run Git commit hooks is disabled and the hook script in .git/hooks has execute permissions.
Cause
The Git configuration option core.hooksPath is set to a custom directory (often added by an external tool such as Husky, Lefthook, or a wrapper script). When core.hooksPath is set, Git ignores the default .git/hooks directory and looks for hooks in the configured path instead. If the configured directory does not contain active hooks, the IDE does not display the Run git hooks option in the Commit dialog.
Resolution
-
Open the Terminal tool window in the project root.
-
Check the current value of the setting:
git config --get core.hooksPath -
If the value points to a directory without active hooks, remove the override from the local repository configuration:
git config --unset-all --local core.hooksPathTo remove the setting from a higher scope, replace
--localwith--globalor--system. -
Reopen the Commit dialog. The Run git hooks option appears in the Commit settings, and hooks from
.git/hooksexecute as expected.
Additional information
For details on configuring Git hooks to run from the IDE, see How to run Git pre-commit hooks while committing from the IDE.
For the official Git documentation on this setting, see git-config: core.hooksPath.
Comments
0 comments
Please sign in to leave a comment.