Inside git hook folder, I have pre push file inside it i am running "npm run coverage" i.e. mand for unit test coverage.
git-hook > pre-push > npm run coverage
but it is not working, can somebody please help me.
Inside git hook folder, I have pre push file inside it i am running "npm run coverage" i.e. mand for unit test coverage.
git-hook > pre-push > npm run coverage
but it is not working, can somebody please help me.
Share Improve this question asked Sep 18, 2017 at 5:39 RVCoderRVCoder 5424 silver badges15 bronze badges 1- Have you checked the permissions of the pre-push file? The execution bit must be set... – Fabien Bouleau Commented Sep 18, 2017 at 6:34
3 Answers
Reset to default 9- Check if its name is precisely
pre-push
(notpre-push.sh
, notpre-push.py
, preciselypre-push
, with no file extension). - Check if it's in
.git/hooks/
. If you have setcore.hooksPath=xxx
in the config, make sure it's under the directoryxxx
. - Check if it's executable.
- Check if the user that runs
pre-push
also has the permission to runnpm run coverage
.
check .git/hooks. If it's empty try to uninstall husky and install again. my sh history
ls .git/hooks
npm uninstall husky
npm i husky -D
ls .git/hooks
it helped me
for your short description,I can't locate the reason. But you can tryhusky
or ghooks
.
husky
or ghooks
provide git hooks,such as premit
,prepush
:
//husky
{
"scripts": {
"premit": "npm test",
"prepush": "npm run coverage",
"...": "..."
}
}