Husky and commitlint do not work before the git commit command

Asked

Viewed 121 times

2

The Husky and commitlint packages were installed to a Nodejs project with the intention of adding Hooks to the commands git commit to maintain the same style guide in commit.

However the Hooks are not being triggered, allowing even poorly formatted messages from commit were executed.

OBS: All the steps of installation guide have already been followed correctly, and the file package.json is already with the necessary stretch to trigger the hook:

// package.json
{
  "husky": {
    "hooks": {
      "commit-msg": "commitlint -E HUSKY_GIT_PARAMS"
    }
  }
}

Environmental data:

  • Linux: 16.04.1-Ubuntu
  • Git: 2.7
  • Node: v12.18.3
  • Husky: 4.3.7
  • @commitlint/cli: 11.0.0
  • @commitlint/config-Conventional: 11.0.0

1 answer

1

In the husky package repository has a not very clear chunk, where it mentions that the minimum version of Git installed should be 2.13.0

Verify that your version of Git is >=2.13.0.

And to upgrade Git to Ubuntu, just run the following commands:

sudo add-apt-repository ppa:git-core/ppa -y
sudo apt-get update
sudo apt-get install git -y
git --version

After you update Git, restart your computer and run the tests again.
I hope I’ve helped.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.