Questions tagged [git-husky]

Git husky is a Git hook. Git hooks are scripts that Git executes before or after events such as: commit, push, and receive. Use this tag for questions specifically about Git husky, not for questions about Git hooks in general.

92 questions
1
vote
1 answer

Module not found error when adding Cypress command to husky pre-push

When running cy run (via npm run test:e2e) from the terminal it works just fine. The same command added to husky pre-push results in the following error: Error: Cannot find module…
Terrabythia
  • 2,031
  • 3
  • 19
  • 29
1
vote
0 answers

Add Husky(Git Hooks) into Azure DevOps Project

My repository is on AzureDevops, and I cloned it by the button: "Clone in VS Code". The repository was cloned correctly. I have the files from package.json, .gitignore, etc... But I don't have a .git folder. And I would like to install some tool to…
1
vote
2 answers

Commitlint not working. git commit -m commitlint message showing unknown argument , husky existed with code 1 (error)

git commit -m "feat: testing the commitlint library" @commitlint/cli@16.2.3 - Lint your commit messages [input] reads from stdin if --edit, --env, --from and --to are omitted Options: -c, --color toggle colored output [boolean]…
1
vote
1 answer

when my mac commits code using Git, rejected by Husky, prompt ` sh:command not found `

When my Mac commits code using Git, it gets rejected by Husky, and I see the following error: > git -c user.useConfigOnly=true commit --quiet --allow-empty-message --file - .husky/_/husky.sh: line 23: sh: command not found husky - pre-commit hook…
Max
  • 21
  • 1
  • 8
1
vote
0 answers

How to use hooks in workspaces with husky in root package.json?

I have to run a command which validates schema during pre-commit using husky hooks. Husky is included in package.json of root directory like this: "workspaces": { "packages": [ "apps", "vendors/*" ], …
Code Geek
  • 33
  • 1
  • 5
1
vote
1 answer

adding auto config formatting the different folders

I have a sample web project which has client and server, so before commit any files I have added husky to make the formatting changes, when I add it as script it works but when I do git add . and git commit its showing as No staged files match any…
dev
  • 814
  • 10
  • 27
1
vote
0 answers

"stylelint" found some error. Please fix them and try committing again

I am getting the error as Running tasks for **/*.{js,jsx} [failed] Error: No files matching the pattern "" are found. husky > pre-commit hook failed. when I am trying to commit the code. Please let me know the cause for this error or the…
1
vote
1 answer

Use Husky without node installed (use in Docker)

We have multiple teams. Frontend and Backend. All Frontend devs have node on the computer, but not the Backend devs. Husky (https://typicode.github.io/husky/#/) installs commit-Hooks. For the Backend devs we get the error message Can't find Husky,…
Patrick
  • 1,562
  • 1
  • 16
  • 33
1
vote
2 answers

Npx not found when runing pre-commit husky script

Environment Node installed in ~/node-v14.15.3-linux-x64/bin/node and already setup in the PATH variable. VSCode 1.55.2 Problem every time when i try to commit the changes in my code i get: .husky/pre-commit: 4: npx: not found husky - pre-commit…
joe_inz
  • 998
  • 2
  • 13
  • 30
1
vote
1 answer

Using husky to parse git commit message

How do I use husky to check for a particular git commit message pattern? Whenever the git commit -m "message" command is invoked, I want to parse the message. How could I do this? How could I receive the git commit message and initiate the…
Amanda
  • 2,013
  • 3
  • 24
  • 57
1
vote
1 answer

Additional command on Husky Hooks fail

I am using husky and commitLint to check the commit messages in one of the repo's I work. package.json "husky": { "hooks": { "pre-commit": "lint-staged", "commit-msg": "commitlint -E HUSKY_GIT_PARAMS" } } pretty straightforward.…
vbotio
  • 1,566
  • 3
  • 26
  • 53
1
vote
0 answers

Wait for husky commit-msg hook to finish completely and run Enquirer

I have a script that I runs during a Git commit to get the current commit message using Husky's commit-msg hook, with that script I make HTTP requests. My challenge is to run another script after the Husky hook script is done. The script I want to…
Thabo
  • 1,303
  • 2
  • 19
  • 40
1
vote
1 answer

Angular 8 Husky, Pre Commit Condition on Code Coverage

I have an angular 8 project and I am trying to set up a case where the user cannot commit unless certain % of code coverage passes. I am using NX Workspace, and Husky to run Linting before committing. I want to run on top of this, ng test, and also…
Missak Boyajian
  • 1,965
  • 7
  • 32
  • 59
1
vote
1 answer

Husky/lint-staged pre-commit formatting issue

Running husky/lint-staged hook for pre-commit formatting (working fine). Having one strange bug where for some reason on one file it keeps formatting the file with a spacing of 1 tab instead of 2 spaces. (husky/lint-staged seems to rewrite/reformat…
uidevthing
  • 1,781
  • 2
  • 12
  • 24
1
vote
0 answers

Husky error in git prepush hook

I tried Husky as an easy git hook manager, and added the following line to my scripts in the 'package.json' file: "prepush": "webpack --config webpack.prod.js && git add ./dist_prod/* && git commit -m \"Automatic commit - webpack build prod\"" The…
Nicolò Gasparini
  • 2,228
  • 2
  • 24
  • 53