Skip to content

Bug: Github Desktop throws an error when running git hooks #13307

Closed

Description

@liaoliaots

Describe the bug

Github Desktop throws an error when running git hooks:

/usr/bin/env: ‘bash’: No such file or directory
husky - pre-commit hook exited with code 127 (error)

If I run git commit -m "fix: update" via git bash, this error does not occur.

Screenshot 2021-11-11 165830

Version & OS

  • Github Desktop: 2.9.4 (x64)
  • OS: Windows 10 Pro 21H1, 64-bit operating system
  • Git: 2.33.1.windows.1
  • husky: 7.0.4
  • lint-staged: 11.2.6

Steps to reproduce the behavior

  1. go to the git project
  2. run npx husky install
  3. run npx husky add .husky/pre-commit 'npx lint-staged'
  4. change some files
  5. input summary "chore: update" in Github Desktop
  6. click "Commit to main"
  7. See error

Expected behavior

This error should not occur

Actual behavior

This error occurred

Screenshots

Screenshot 2021-11-11 165053

Logs

2021-11-11.desktop.production.log

2021-11-11T08:52:43.540Z - info: [ui] [AppStore] loading 1 repositories from store
2021-11-11T08:52:43.541Z - info: [ui] [AppStore] found account: liaoliaots (LiaoLiao)
2021-11-11T08:52:43.553Z - info: [ui] [BranchPruner] Last prune took place in a day - skipping
2021-11-11T08:52:44.102Z - info: [ui] launching: 2.9.4 (Windows 10.0.19043)
2021-11-11T08:52:44.103Z - info: [ui] execPath: 'C:\Users\LiaoLiao\AppData\Local\GitHubDesktop\app-2.9.4\GitHubDesktop.exe'
2021-11-11T08:52:52.178Z - error: [ui] `git commit -F -` exited with an unexpected code: 1.
stderr:
/usr/bin/env: ‘bash’: No such file or directory
husky - pre-commit hook exited with code 127 (error)

2021-11-11T08:52:52.179Z - info: [ui] [Timing] Action 'create commit' for 'liaoliaots/codeliaoliao-app' took 0.416s

Additional context

.lintstagedrc.js

module.exports = {
    '*.{ts,tsx}': ['prettier --write', () => 'tsc -p tsconfig.json', 'eslint --ext .ts,.tsx']
};

git config --list

Screenshot 2021-11-11 170354

Activity

  1. sergiou87 commented on Nov 12, 2021

    @sergiou87
    Member

    Thanks for your report @liaoliaots !

    This seems to be a duplicate of #12562 so I'm gonna close in favor of that. I'd suggest to write a comment there and subscribe in case there is any progress to address this.

  2. chrisauret commented on May 10, 2022

    @chrisauret

    Same issues. Then I updated my PATH as shown here typicode/husky#950
    Fixed it for me

    Version & OS
    Github Desktop: 3.0.0 (x64)
    OS: Windows 10 Pro 21H1, 64-bit operating system
    Git: 2.33.1.windows.1
    husky: 8.0.0
    lint-staged: 12.4.1

  3. raubana commented on May 11, 2022

    @raubana

    I also have this problem. Seems to happen for pre-push as well but with even more errors.

  4. Mahek-Vasoya commented on Jan 30, 2024

    @Mahek-Vasoya

    I have the same problem for mac os. do we have any solution for that?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions