0

I have been asked to run the following command within my git repo in order to install pre-commit:

pre-commit install --hook-type commit-msg

However when attempting to commit code using GitKraken i'm getting the following error, this is on Windows 10.

### version information

pre-commit version: 2.19.0
git --version: git version 2.35.1.windows.2
sys.version:
    3.9.1 (tags/v3.9.1:1e5d33e, Dec  7 2020, 17:08:21) [MSC v.1927 64 bit (AMD64)]
sys.executable: C:\python39\python.exe
os.name: nt
sys.platform: win32

### error information

An unexpected error has occurred: ExecutableNotFoundError: Executable `/bin/bash` not found

Traceback (most recent call last):
  File "C:\python39\lib\site-packages\pre_commit\error_handler.py", line 73, in error_handler
    yield
  File "C:\python39\lib\site-packages\pre_commit\main.py", line 361, in main
    return hook_impl(
  File "C:\python39\lib\site-packages\pre_commit\commands\hook_impl.py", line 232, in hook_impl
    retv, stdin = _run_legacy(hook_type, hook_dir, args)
  File "C:\python39\lib\site-packages\pre_commit\commands\hook_impl.py", line 42, in _run_legacy
    cmd = normalize_cmd((legacy_hook, *args))
  File "C:\python39\lib\site-packages\pre_commit\parse_shebang.py", line 82, in normalize_cmd
    exe = normexe(cmd[0])
  File "C:\python39\lib\site-packages\pre_commit\parse_shebang.py", line 61, in normexe
    _error('not found')
  File "C:\python39\lib\site-packages\pre_commit\parse_shebang.py", line 51, in _error
    raise ExecutableNotFoundError(f'Executable `{orig}` {msg}')
pre_commit.parse_shebang.ExecutableNotFoundError: Executable `/bin/bash` not found
// .pre-commit-config.yaml

ci:
  skip:
    - actionlint

repos:
  - repo: https://github.com/alessandrojcm/commitlint-pre-commit-hook
    rev: v8.0.0
    hooks:
      - id: commitlint
        stages: [commit-msg]
        additional_dependencies: ['commitlint-plugin-jira-rules', 'commitlint-config-jira']
  # - repo: https://github.com/editorconfig-checker/editorconfig-checker.python
  #   rev: 2.4.0
  #   hooks:
  #     - id: editorconfig-checker
  - repo: https://github.com/rhysd/actionlint
    rev: v1.6.12
    hooks:
      - id: actionlint
  - repo: https://github.com/pre-commit/pre-commit-hooks
    rev: v4.2.0
    hooks:
      - id: check-merge-conflict

How can I solve this, attempted to do a Google Search but to not success.

Martyn Ball
  • 4,679
  • 8
  • 56
  • 126

1 Answers1

1

Found the solution, just had to delete .git/hooks/pre-commit.legacy and then reinstall, I also deleted .git/hooks/pre-commit just to be sure before installing again.

Martyn Ball
  • 4,679
  • 8
  • 56
  • 126