Communities

Writing
Writing
Codidact Meta
Codidact Meta
The Great Outdoors
The Great Outdoors
Photography & Video
Photography & Video
Scientific Speculation
Scientific Speculation
Cooking
Cooking
Electrical Engineering
Electrical Engineering
Judaism
Judaism
Languages & Linguistics
Languages & Linguistics
Software Development
Software Development
Mathematics
Mathematics
Christianity
Christianity
Code Golf
Code Golf
Music
Music
Physics
Physics
Linux Systems
Linux Systems
Power Users
Power Users
Tabletop RPGs
Tabletop RPGs
Community Proposals
Community Proposals
tag:snake search within a tag
answers:0 unanswered questions
user:xxxx search by author id
score:0.5 posts with 0.5+ score
"snake oil" exact phrase
votes:4 posts with 4+ votes
created:<1w created < 1 week ago
post_type:xxxx type of post
Search help
Notifications
Mark all as read See all your notifications »
Q&A

Welcome to Software Development on Codidact!

Will you help us build our independent community of developers helping developers? We're small and trying to grow. We welcome questions about all aspects of software development, from design to code to QA and more. Got questions? Got answers? Got code you'd like someone to review? Please join us.

Post History

75%
+4 −0
Q&A How to make Husky run git hook?

How to make Husky run git hook? I have a working git hook, prepare-commit-message, but the moment Husky was installed, the hook stopped working. Not finding much luck, I then tried to make it a "H...

1 answer  ·  posted 11mo ago by LAFK‭  ·  edited 11mo ago by Alexei‭

Question git husky git-hook
#3: Nominated for promotion by user avatar Alexei‭ · 2023-06-25T09:47:18Z (11 months ago)
#2: Post edited by user avatar Alexei‭ · 2023-06-24T07:02:46Z (11 months ago)
replaced with more specific hook tag
#1: Initial revision by user avatar LAFK‭ · 2023-06-24T00:38:13Z (11 months ago)
How to make Husky run git hook?
How to make Husky run git hook? I have a working git hook, prepare-commit-message, but the moment Husky was installed, the hook stopped working. 

Not finding much luck, I then tried to make it a "Husky git hook" and run it like that, so I installed it via `npx husky add prepare-commit-message content`, but this did not help.

Summary of the situation:

1. git hook on it's own - works
2. two other husky git hooks - work on their own (pre-commit, pre-push)
3. `git config -e` and hooksPath set as `.husky`
4. my script as a husky hook, installed like above - makes commit-related two Husky hooks no longer work. `git commit` never happens, instead pre-commit hook fails with a message that 

> .husky/pre-commit: 2: .: cannot open .husky/husky.sh: No such file

or, if I move `pre-commit` one out:

> .husky/prepare-commit-msg: 8: .: cannot open .husky/_/husky.sh: No such file

However, interestingly, if I _REMOVE_ the config bit about `.husky` dir, `git commit` opens normally, but without what I'd expect from `prepare-commit-message`.

At this point I'm kind of stumped, so any help is welcome.