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
0
votes
1 answer
Source control and terminal conflict (version.json typechange)
I encountered an error when attempting to commit via the VSCode source control. The OUTPUT tab revealed that Git was searching for version.json (which is a symlink) with the incorrect path. After some research, I found a solution here. However, now…

Bernardo Marques
- 925
- 2
- 10
- 33
0
votes
0 answers
Husky git hook deletes changes in unstaged files when lint staged fails
I have installed husky to use it as a pre commit git hook. I am also using lint-staged. My package.json has following scripts:
"lint-staged": {
"src/**/*.{ts,tsx,css,md,json}": "yarn run format",
"*.{ts,tsx}": "yarn run lint:fix"
},
…

Leff
- 1,968
- 24
- 97
- 201
0
votes
0 answers
For Husky pre-push hook, how can I make "echo" command to display information in VSCode Output?
I have 2 Husky hooks: pre-commit and pre-push. In both hooks, I use echo to print out progress information and call tasks such as build and test. While the pre-commit hook prints the output as expected (both the echo as well as the tasks output),…

Cupid Chan
- 496
- 4
- 15
0
votes
1 answer
Husky: cannot spawn .husky/commit-msg: No such file or directory
I have been working with husky for few years now. We started a new project and was sure to add husky for pre-commit and commit-msg linting. But this time we faced some issue in the windows machine.
We configured the husky in the project using a mac.…

AMAL MOHAN N
- 1,416
- 2
- 14
- 26
0
votes
0 answers
husly pre push to git add dist?
I have an npm package that need to build dist folder on every change. I'm stuck on creating the husky command in pre-push.
I have .husky/pre-push, but this doesn't work
npm run build && git add dist && git commit -m 'add dist' --no-verify && git…
0
votes
1 answer
Regex not working with husky commit-msg hook
.husky/commit-msg
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"
PATTERN_COMMITS='(^IMO-[0-9]+\s#time\s([0-9]+([.][0-9]+)?[wdhm])([ ][0-9]+([.][0-9]+)?[wdhm])*\s\|\s[[:alnum:]_].+|Merge|Revert|Apply)'
msg=$(cat $1 | sed '/^#.*/d')
if ! [[…

Ram
- 3
- 2
0
votes
0 answers
How can I give a file as an input to the precommit hook in angular
There has been some incidence where I have committed some file with 'fdescribe' and 'fit' and the build failed. A lot of time gets wasted on this.
I want that I should not even be allowed to commit the file in this case.
I see we can use precommit…

user16806836
- 91
- 1
- 1
- 3
0
votes
0 answers
Error in Vercel Pipeline while creating build for react + vite + eslint + prettier +husky
Error in Vercel Pipeline while creating a build for react + vite + eslint + prettier +husky
How can I avoid my build getting failed, should we skip precommits rules while creating build or not, if yes then what are changes do I need to make in…

Sanket Patil
- 807
- 1
- 11
- 19
0
votes
0 answers
Husky - how to add an additional pre-commit script?
I am new to husky, and the official documentation isn't so clear to me.
I am using Yarn 1.
Husky 8.
Problem:
I can't add a new (additional) pre commit script.
Current status:
I managed to add 1 pre-commit script that works fine.
This is the script I…

Pikk
- 2,343
- 6
- 25
- 41
0
votes
1 answer
husky and lint staged not prettifying the code
Working with the react project.
Here is my project sturcture
Here is my package.json
{
"name": "frontend",
"version": "0.1.0",
"private": true,
"scripts": {
"build": "webpack --mode production",
"build:dev": "webpack --mode…

Profer
- 553
- 8
- 40
- 81
0
votes
0 answers
Codefresh git-commit with husky yarn pre-commit
We are using the git-commit Codefresh step to push updates during a build. We use husky and have pre-commit hooks that rely on yarn. This fails within the step because the dependency is missing.
How should we handle these hooks?
Here is the current…

Joseph Pasque
- 41
- 2
0
votes
1 answer
Can't run commitlint in husky with another custom command
How can I have two precommit hooks in husky? I'm looking to use commitlint along side a custom script defined in my package.json. I have installed husky and have a pre-commit script in the .husky folder. Here is what I've tried:
#!/usr/bin/env sh
.…

afriedman111
- 1,925
- 4
- 25
- 42
0
votes
0 answers
Do we need to configure ESlint, Prettier, Husky separately for both Frontend and Backend folder Project?
I am developing MERN project.
Folder Structure
0
votes
0 answers
How to force developers to use a specific commit message
Our product documentation tells our developers to run git config commmit.template .gitmessage. However, many developers have not done so and are not following our commit template.
I'm using the following husky hook to stop a commit if they haven't…

Ruan Mendes
- 90,375
- 31
- 153
- 217
0
votes
1 answer
husky install causes patherror
I am trying to manually add Husky to my project as described here:
https://typicode.github.io/husky/#/?id=manual
I run npm install husky --save-dev and husky is added and installed as a dev dependency as it should be.
Then I try to run npx husky…

Oblivial
- 53
- 5