husky: Push doesn't always occur
Before creating an issue, see troubleshoot section in the README and verify that you’re using Git >= 2.13.0
.
Please provide your OS, terminal and the following commands output: OS: Mac 10.15.4 Terminal: ZSH/VS Code Git Client Git: 2.18.0
$ HUSKY_DEBUG=1 npm install husky --save-dev
> husky@3.1.0 preuninstall /Users/brianduffey/project/node_modules/husky
> node husky uninstall
husky:debug Current working directory is '/Users/brianduffey/project/node_modules/husky'
husky:debug INIT_CWD environment variable is set to '/Users/brianduffey/project'
husky > Uninstalling git hooks
husky:debug Git rev-parse command returned:
husky:debug --show-top-level: /Users/brianduffey/project
husky:debug --git-common-dir: ../../.git
husky > Done
> husky@3.1.0 install /Users/brianduffey/project/node_modules/husky
> node husky install
husky:debug Current working directory is '/Users/brianduffey/project/node_modules/husky'
husky:debug INIT_CWD environment variable is set to '/Users/brianduffey/project'
husky > Setting up git hooks
husky:debug Git rev-parse command returned:
husky:debug --show-top-level: /Users/brianduffey/project
husky:debug --git-common-dir: ../../.git
husky:debug Installing hooks in '../../.git/hooks'
husky > Done
> husky@3.1.0 postinstall /Users/brianduffey/project/node_modules/husky
> opencollective-postinstall || exit 0
Thank you for using husky!
If you rely on this package, please consider supporting our open collective:
> https://opencollective.com/husky/donate
$ HUSKY_DEBUG=1 git commit # ...
We had to roll back to Husky v3 due to the issue about hooks not getting called when using VS Code’s Git client (which most of the team is using). However, this issue occurred on that as well as on our current version (3.1.0).
I’m unsure if this is a husky issue or something else, but on pre-push, we execute all of our unit tests with jest, and then if it passes, push up to origin. However, as we continue to build out tests, these take longer and longer and it seems like when the tests take somewhere in the 52-54sec or more range, then the push just never occurs even though the tests all passed. Our pre-commit hook, which is much faster works fine, and if the tests take less than 52secs, it pushes fine as well.
Here is our husky config:
"husky": {
"hooks": {
"post-merge": "npm run setup",
"pre-commit": "lint-staged",
"pre-push": "npm run test:no-watch"
}
},
and here is the test:no-watch script:
"test:no-watch": "cross-env CI=true REACT_APP_ENV=testing TZ=America/Chicago npm test -- --env=jsdom"
Anything else I can provide, I would be happy to do so, but the repo is private so cannot share that. The actual output when it works or fails is no different, other than when it works I see the push occur after the tests. Thanks!
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Reactions: 4
- Comments: 16 (2 by maintainers)
Having the same issue here; tried increasing the ssh timeout but no luck. This may be due to the tests taking too long. Is there a way husky can handle such?
I’m having similar issues. I also tried increasing the timeout with no luck. 😕
Our team is facing this issue randomly as well.
@bduff9 Hi, I was experiencing the same issue till today. But in my case, I was not able to push stuff without
--no-verify
at all. The colleague of mine said that it is my SSH connection hanging up. It can be fixed by increasing the timeout or setting it up so that it won’t time out at all. Try this. It helped me.Ha, actually first push this issue happened again.
So looks like it is exiting but push still did not happen. Here is a successful push that I ran right after it: