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.
Questions tagged [git-husky]
92 questions
3
votes
1 answer
How are devinstall and devuninstall scripts being used?
I am trying to reuse husky for other projects (not just config file), building a lib of sorts that will be used by all other projects.
I cannot understand how and when devinstall and devuninstall scripts are executed. Cannot find any documentation…

Deep Vora
- 318
- 3
- 13
2
votes
1 answer
Can you git add new files during the Husky "commit-msg" hook?
I am trying to setup an auto-versioning system where if I git commit with the message PATCH: {message}, the app's patch version will automatically update (and likewise for a prefix of MINOR and MAJOR as well). I am using Husky for my pre-commit and…

Paradoxdotexe
- 141
- 7
2
votes
1 answer
how do i install husky to use commitlint with nested folders?
I've already installed husky and commitlint, but when I make a commit that commitlint should consider invalid, it normally passes as if it wasn't installed.
That's my directory tree
i have one script that installs husky on package.json:
{
"name":…

alexandreafa
- 66
- 5
2
votes
3 answers
How to configure husky pre-push hook to run tests
I am trying to configure husky pre-push hook to run tests before push. Everything looks fine. After run git push origin hook is fired and tests are runing. Problem is that when tests are done and even if operation is successed, push is freezed and…

obaram
- 321
- 2
- 4
- 13
2
votes
1 answer
.husky/pre-commit: 2: .: Can't open .husky/_/husky.sh
In a project, we use Husky but when I try to add a commit with git add . and git commit -m "test", I receive below error
.husky/pre-commit: 2: .: Can't open .husky/_/husky.sh
How can i fix this problem ?
My operating system is Windows but I use…

Ayse8888
- 137
- 2
- 16
2
votes
0 answers
Github desktop returns error about comand not found with husky
I am new with husky. I can make commits in git cmd using the git commands and all, but i want to use gitgub desktop for it.
I have an application using "husky": "^7.0.4", and Github desktop Version 2.9.6.
I couldn't find a solution for it. i have…

Modena
- 75
- 8
2
votes
1 answer
Why is lint-staged running on unstaged files with my configuration?
I have husky and lint-staged set up in my package.json file and it runs, but on all files, whereas I would expect it to run on only staged files.
"husky": {
"hooks": {
"pre-commit": "lint-staged"
}
},
"lint-staged": {
"./**/*.js": [
…

zeckdude
- 15,877
- 43
- 139
- 187
2
votes
0 answers
husky pre-push exits with code 0 but the push never happens
I am exiting with code 0 in my pre-push hook, but the push never happens.
Any idea why my hooks ends successfully but the push does not happen?
here is my husky.config.js:
module.exports = {
hooks: {
'post-checkout': 'post-checkout',
…

Ken Bigler
- 587
- 1
- 4
- 15
2
votes
1 answer
terminated with SIGABRT
I am using Husky for linting files before commit files.
But today suddenly getting some weird issue like below
╰─ node_modules/husky/run.js pre-commit husky > pre-commit (node v10.15.0) ↓ Stashing changes... [skipped]
→ No partially staged…

Rituraj ratan
- 10,260
- 8
- 34
- 55
2
votes
0 answers
Husky - sed: -i may not be used with stdin
I have a hook that will prepend the JIRA ticket number before the commit message. I want to be able to share it with the rest of my team, which is why I am using Husky. It worked fine when in .git/hooks, however, after changing folders and calling…

Michael Vytlingam
- 73
- 1
- 8
2
votes
0 answers
Jasmine pre-commit hook to check for excluded/focused tests
During development I often exclude/focus tests. I want to make sure that those tests are not commited.
Every occurence of xdescribe, fdescribe, xit or fit should trigger an error with the file and line number where it occurred.
Is there a…

CodeChimpy
- 560
- 1
- 6
- 26
2
votes
1 answer
Git add in pre-commit hook not staging file for commit
I have written a pre-commit hook that compiles my project and adds the generated file to the commit.
This is a JavaScript project and I am using husky, but I have experimented with editing the .git/hooks/pre-commit as well and the file is not…

Heather Roberts
- 1,978
- 1
- 24
- 33
2
votes
1 answer
Can't commit when combining commitizen + husky: nvm is not compatible with the "npm_config_prefix" environment variable
I have a project that was using commitizen without problems. I've decided to add husky to run precommit hooks with prettier. The problem is that when I run the npm run cm command, I get this error...
.....................
? Are there any breaking…

A. Iglesias
- 2,625
- 2
- 8
- 23
2
votes
1 answer
tslint precommit hook shows all the linting errors before but also allows to commit the code
I am using angular-seed & husky to add a precommit hook for git. My package.json has
"scripts": {
"precommit": "npm test && npm run lint",
}
When I commit the code, husky runs "npm test" & "npm run lint" fine. When npm test fails, it shows me…

Ashwin Suryawanshi
- 23
- 3
1
vote
1 answer
trying to use pre-commit hooks using husky not working
I'm been configuration husky for a while but i been encounter in this issue i think i have the right configuration but when i try to commit the hooks is not been call.
the below is my code base
package.json
{
"name": "frontend",
"version":…

Carlos Damian Perez
- 109
- 3
- 9