Pre Commit Hook Error
See original GitHub issueWhen running the precommit hook it always fails with the message:
.git/hooks/pre-commit: line 22: =0: command not found
This is probably because of this line:
$gradleCommandExitCode=$?
Imo the leading $ should be removed.
This also has the very bad sideffect that the old stash is not applied and the code that wasn’t staged is lost.
Tested on macos, Ktlint 10.2.1
Issue Analytics
- State:
- Created 2 years ago
- Reactions:3
- Comments:5
Top Results From Across the Web
Pre Commit hook git error - Stack Overflow
Your pre-commit file has extraneous carriage returns in it. This can happen if you edit the file in Windows and copy the file...
Read more >pre-commit
We run our hooks on every commit to automatically point out issues in code such as missing semicolons, trailing whitespace, and debug statements....
Read more >Git commit hook error messages no longer display - YouTrack
Git commit hook error messages no longer display · 1. Create a new git repository · 2. Add the following pre-commit hook (and...
Read more >Commit blocked by pre-commit hook (exit code 255) with no ...
pre-commit script, regardless of the script's contents. ... So this implies that the hook can work and may not be at fault at...
Read more >Use Git pre-commit hooks to avoid AWS CloudFormation errors
With the approach we propose, you configure pre-commit hooks for your project and commit your changes to the repo. Then Git inspects your...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@PauloHC, after installing the pre-commit, it should be available in
.git/hooks/pre-commit
. Line 22 should look like$gradleCommandExitCode=$?
. The workaround is to change it togradleCommandExitCode=$?
I found the line here. Now the hook is working. Thank you very much @jmbarroso !