Improve context on pre-commit hook failures and provide escape hatch
See original GitHub issueDescribe the bug
I cannot commit to the excalidraw/excalidraw
repo in GitHub Desktop. Using GitUp (another GUI) or the git
CLI both work fine.L
Version & OS
GitHub Desktop Version 2.4.0, macOS Version 10.15.3 (19D76)
Steps to reproduce the behavior
- Clone
https://github.com/excalidraw/excalidraw
- Run
npm install
to install the dependencies - Open the repo in your favorite editor and delete lines 8–18 of
src/index.tsx
so you have something to commit. - In GitHub Desktop, commit the change.
Expected behavior
The commit occurs successfully.
Actual behavior
An error dialog displaying this text:
Commit failed - exit code 1 received, with output: 'husky > pre-commit (node v13.11.0)
Preparing... [started]
Preparing... [failed]
→ error: unknown option 'ignore-skip-worktree-entries'
usage: git update-index [<options>] [--] [<file>...]
[removed: listing of all options]
Cannot save the current worktree state
Running tasks... [started]
Running tasks... [skipped]
→ Skipped because of previous git error.
Applying modifications... [started]
Applying modifications... [skipped]
→ Skipped because of previous git error.
Cleaning up... [started]
Cleaning up... [skipped]
→ Skipped because of previous git error.
✖ lint-staged failed due to a git error.
Any lost modifications can be restored from a git stash:
> git stash list
stash@{0}: On master: automatic lint-staged backup
> git stash pop stash@{0}
error: unknown option 'ignore-skip-worktree-entries'
[removed: listing of all options]
Cannot save the current worktree state
husky > pre-commit hook failed (add --no-verify to bypass)
Additional context
I’m guessing this is because --ignore-skip-worktree-entries
was recently added to Git and Husky is using Desktop’s bundled version for some reason?
Issue Analytics
- State:
- Created 3 years ago
- Reactions:17
- Comments:17 (4 by maintainers)
Top Results From Across the Web
Error in committing rubyonrails code in Github - Stack Overflow
desktop/desktop issue 9351: "Improve context on pre-commit hook failures and provide escape hatch". So you have to option a command-line: press ...
Read more >Improving your life with pre-commit
[pre-commit] is a multi-language package manager for pre-commit hooks. ... Now these mistakes can be automatically prevented before the commit is made.
Read more >pre-commit
We built pre-commit to solve our hook issues. It is a multi-language package manager for pre-commit hooks. You specify a list of hooks...
Read more >Automatically checking for syntax errors with Git's pre-commit ...
This block is an escape hatch. One day I will want to bypass the hook and make a commit without performing the checks,...
Read more >Comparing Code Quality Meta Tools - Dave Rolsky
What's a code quality meta tool? It's a tool that lets you orchestrate many linting and formatting tools to operate on an entire...
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
This came up again in #11802. If a contributor wants to take a crack at adding a “Commit anyway” button to the error dialog, I think that’d be a great next step.
I’ve confirmed with @j-f1 that
git config stash.usebuiltin false
fixes the issue, so this can be used as a workaround.It’s still unclear why does lint-staged executes the system git binary in some systems. This could probably be caused by some specific bash configuration…
Anyways, I see 3 different things going on here:
git
, which causesgit
to spawn internally a binary of a different version causing failures when usingGIT_EXEC_PATH
.Maybe we can refocus this issue (or create a new issue) to try to address point 3. so: