question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

include the output from a pre-push commit hook failure

See original GitHub issue

I’m running tsc and tslint in a pre-push hook, and GitHub Desktop shows a message when the hook finds a problem: “error Command failed with exit code 1”.

It would be useful if this message included the output from the git hook, to help with diagnosing the problem.

Issue Analytics

  • State:open
  • Created 5 years ago
  • Reactions:8
  • Comments:8 (7 by maintainers)

github_iconTop GitHub Comments

2reactions
hubgitcommented, Aug 20, 2018

I’m only talking about pre-push hooks, but https://github.com/desktop/desktop/issues/5325#issuecomment-410066732 is about pre-commit hooks.

In this particular case I’m running tsc --noEmit --project tsconfig.json && tslint --project tsconfig.json as a pre-push hook via husky, and this is the output when running git push from the command line:

husky > pre-push (node v8.9.4)
yarn run v1.9.4
$ tsc --noEmit --project tsconfig.json && tslint --project tsconfig.json
src/lib/example.ts:232:14 - error TS2304: Cannot find name 'bar'.

232       return bar
                 ~~~

error Command failed with exit code 1.

When pushing in GitHub Desktop, the only output displayed in the error alert is this:

error Command failed with exit code 1.
error: failed to push some refs to 'git@***.com:***/***.git'

The output from husky when running the same script as a pre-commit hook is identical:

husky > pre-commit (node v8.9.4)
yarn run v1.9.4
$ tsc --noEmit --project tsconfig.json && tslint --project tsconfig.json
src/lib/example.ts:232:14 - error TS2304: Cannot find name 'bar'.

232       return bar
                 ~~~

error Command failed with exit code 1.

When run as a pre-commit hook, GitHub Desktop displays the full output:

Commit failed - exit code 1 received, with output: 'husky > pre-commit (node v8.9.4)
yarn run v1.9.4
$ tsc --noEmit --project tsconfig.json && tslint --project tsconfig.json
src/lib/example.ts(232,14): error TS2304: Cannot find name 'bar'.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
husky > pre-commit hook failed (add --no-verify to bypass)'
0reactions
kael89commented, Feb 9, 2021

I also bumped into this issue when using a pre-push hook. I am new to this project but will attempt a PR 🙂

Read more comments on GitHub >

github_iconTop Results From Across the Web

husky > pre-commit hook failed (add --no-verify to bypass)
In my case I started getting husky > pre-commit hook failed (add --no-verify to bypass) once some dependencies have been updated.
Read more >
Show the output of the git hook scripts : IDEA-82777 - YouTrack
A colleague just pointed me to another view within PyCharm that correctly displays the pre-commit output: The git console (you might have to...
Read more >
Failing to get commit message from pre push git hook - Support
Hi, I am trying to get the commit message during the git pre push hook stage, but it is not retrieving the message...
Read more >
Getting Started with Git Hooks and Husky | Tower Blog
When you have some Git hooks configured in Husky, you will get an error message ... husky - pre-commit hook exited with code...
Read more >
Supported hooks - pre-commit
check-docstring-first - checks a common error of defining a docstring after code. check-executables-have-shebangs - ensures that (non-binary) executables have a ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found