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.

Commit does not work if there are git hooks from husky and lint-staged

See original GitHub issue

Does this issue occur when all extensions are disabled?: Yes

  • VS Code Version: 1.58.2
code --version    
1.58.2
c3f126316369cd610563c75b1b1725e0679adfb3
x64
  • OS Version: Ubuntu 20.04

Steps to Reproduce:

  1. configure husky and lint-staged
  2. check that commiting from CLI works
  3. try commiting from VSCode
  4. get error “Git: Failed to execute git”
  5. see following in git log in Output:
> git -c user.useConfigOnly=true commit --quiet --allow-empty-message --file -
> git config --get-all user.name
> git config --get-all user.email

Issue Analytics

  • State:open
  • Created 2 years ago
  • Reactions:1
  • Comments:8

github_iconTop GitHub Comments

2reactions
alexamycommented, Feb 20, 2022

Having the same problem, but with yarn: command not found, my temp solution was to edit ~/.huskyrc, as mentioned here:

export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"

export PATH="$HOME/.yarn/bin:$HOME/.config/yarn/global/node_modules/.bin:$PATH"
1reaction
rmclaughlin-nelnetcommented, Aug 26, 2022

I am having the same problem. When I view the git logs I see this. This only recently started happening to me so it may not be the same as mentioned in the op

[2022-08-26T17:50:51.747Z] env: node: No such file or directory
husky - pre-commit hook exited with code 127 (error)
husky - command not found in PATH=/usr/local/Cellar/git/2.35.1/libexec/git-core:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin
Read more comments on GitHub >

github_iconTop Results From Across the Web

lint-staged not running on precommit - Stack Overflow
The way I found out it was a problem with husky and npm was because I found out that I had no pre-commit...
Read more >
Run ESLint on git commit with Husky and Lint Staged
The answer is lint-staged. It is a package that helps in running pre-commit hooks only on files that have been changed in current...
Read more >
Diving into Husky and Lint-staged | Laurie on Tech
This means files you've changed or created but haven't yet committed to your project. Working on staged files limits the number of files...
Read more >
Set Up Git hooks with husky and lint-staged — Angular Example
If you don't have Angular CLI installed you can use the repository ... It's helpful to run git hooks only on files that...
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 ... .husky/pre-commit: line 4: npx: command not found husky...
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