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
78
votes
8 answers

husky > pre-commit hook failed (add --no-verify to bypass)

Suddenly I am getting the "husky > pre-commit hook failed (add --no-verify to bypass)" error message when I give the git commit. (C:\Windows\System32\cmd.exe) > git commit husky > npm run -s precommit (node v12.18.3) 'pretty-quick' is not…
Sathiamoorthy
  • 8,831
  • 9
  • 65
  • 77
68
votes
12 answers

sh: husky: command not found

I've setup a node project with husky but when my collegue tries to run npm install on his Mac he gets the following error : noa-be@1.0.0 prepare husky install sh: husky: command not found npm ERR! code 127 npm ERR! path…
GaelF
  • 877
  • 1
  • 6
  • 8
23
votes
6 answers

Husky/lint-staged is it possible to exclude/ignore file?

Is it possible to exclude/ignore a file when using Husky/lint-staged hooks? Looking through the docs atm but not having any luck finding anything on this. Was hoping there was something like an /*ignore*/ tag that I could add. To make lint-staged…
uidevthing
  • 1,781
  • 2
  • 12
  • 24
22
votes
4 answers

Git push failed due to husky pre-push on sourcetree

While pushing a react native project, I'm getting error due to husky pre-push failed husky > pre-push hook failed (add --no-verify to bypass) All these errors shown are lint errors like the below unused-vars 27:48 error Trailing spaces not…
krishnakumarcn
  • 3,959
  • 6
  • 39
  • 69
19
votes
3 answers

vsCode issue with husky

I have configured husky in my project. It is running the pre-commit hook with "lint-staged" to use "prettier" to format the code before each commit. The configuration works fine when I use the terminal to invoke the git commit. However, if I commit…
dnaveen
  • 221
  • 3
  • 8
18
votes
2 answers

Why are my changes gone after a cancelled git commit and how do I recover them?

Here's what I did: Coded 8 hours worth of changes. git status displays all my changes. git add -A git commit -m "Foo". A pre-commit git hook fires with husky and lint-staged. I remember that there's a TypeScript typing error I failed to fix, so I…
Andrey Mikhaylov - lolmaus
  • 23,107
  • 6
  • 84
  • 133
16
votes
4 answers

How do I resolve .husky/_/husky.sh: No such file or directory error when using husky?

A project that I'm working on with colleagues uses husky versions ^5.1.0 and I keep getting this error when I'm trying to push my commit. .husky/_/husky.sh: No such file or directory How do I resolve this? I'm currently using git version 2.18.0. I…
Bryan Lee
  • 949
  • 8
  • 19
15
votes
5 answers

How to run husky pre-commit in child directory only

We have an enterprise application with a folder structure like the following: /project .git /sub1 ...Java project /sub2 package.json ...Javascript Backbone project /sub3 ...Java project /sub4 ...Java project /sub5 …
JoshT
  • 187
  • 1
  • 1
  • 6
11
votes
2 answers

Pylint with pre-commit and EsLlint with husky

I have a project with a frontend in JS and backend in Python. Frontend had been configured with husky pre-commit hook. Today I've configured Pylint with pre-commit library but husky hooks had been overwritten by that move. Is it possible to combine…
Aleksandr Zakharov
  • 334
  • 1
  • 4
  • 16
9
votes
2 answers

How to access commit message with Husky pre-commit hook?

My husky script: "husky": { "hooks": { "pre-commit": "sh ./tools/githooks/pre-commit.sh" } } Let's say I am doing a git commit -m "I want that text". How can I access to my commit message within the shell script? I tried to echo…
Potatoes
  • 300
  • 3
  • 13
9
votes
5 answers

Why test in continuous integration if you can test on pre-commit and pre-push git hooks?

What is the point of using a Continuous Integration system to test your code if you already have a system like Husky running that allows you to test you code before pre-commit and pre-push?
Rick Bross
  • 1,060
  • 3
  • 16
  • 39
8
votes
2 answers

GitHub desktop Husky pre-commit hook does not

I installed husky@4 and lint-staged as per many other projects (on Mac OS11). The terminal command flow git add . and git commit -m 'something' flow works fine: Husky's pre-commit hook and lint-staged commands are picked up successfully. However,…
Phil Lucks
  • 2,704
  • 6
  • 31
  • 57
8
votes
2 answers

How to bypass pre-commit hooks after fixing merge conflicts?

TLDR: git rev-parse -q --verify MERGE_HEAD errors out when NOT in a merge state. How can I get a similar command that would error out when we're IN a merge state? Problem: when I merge master into my branch and it has conflicts, I have to manually…
Flavio Wuensche
  • 9,460
  • 1
  • 57
  • 54
7
votes
1 answer

Using Husky with Docker when no Node.js is available in local

Working with Docker, I'm trying to make Husky work when there is Node.js in the container but no on the local machine. As it will be triggered with git commands, with the info from here: "if you're running git commands in the terminal, husky will…
lewislbr
  • 1,012
  • 14
  • 23
7
votes
3 answers

How to prevent direct commits to master branch using husky?

I am using husky to run git hooks. "husky": { "hooks": { "commit-msg": "commitlint -E HUSKY_GIT_PARAMS" } } I want to prevent direct commits to master branch. It should allow the master branch to be updated only by merge requests. I…
It worked yesterday.
  • 4,507
  • 11
  • 46
  • 81
1
2 3 4 5 6 7