Skip to content

core.hooksPath is .husky/_, examples create hooks in .husky, prepare: husky overwrites anything .husky/_Β #1574

@jshreck

Description

@jshreck

husky version: 9.1.7
package manager: yarn

I have verified that hooks should live in .husky/_ based on https://typicode.github.io/husky/troubleshoot.html#hooks-not-running. When running husky init or referencing the documentation it references storing hooks in .husky folder so it seems like this should be updated to reference .husky/_

The docs also suggest including the prepare script to run husky (https://typicode.github.io/husky/how-to.html#manual-setup), which would overwrite anything in the .husky/_ folder. Is this intentional, and users are expected not to commit any changes here? I removed the .gitignore here because these hooks need to be shared for the repo.

I have come up with a solution by removing the prepare script (so the hooks do not get overwritten) and adding a postinstall script git config core.hooksPath .husky/_ because I don't want users to manually have to do this, but it feels like I'm either doing something wrong or this should be called out in the docs.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions