evilmartians / lefthook

Fast and powerful Git hooks manager for any type of projects.
MIT License
4.66k stars 211 forks source link

Installation command creates a folder named --help #769

Closed sawa-ko closed 1 month ago

sawa-ko commented 1 month ago

:wrench: Summary

When I run the command lefthook install (using pnpm exec) a folder named --help is created.

Lefthook version

1.7.2

Steps to reproduce

  1. Install lefthook
  2. Use the command lefthook install
  3. See the --help folder created by lefthook

Expected results

Some .lefthook folder or something like that and not a folder named --help.

Actual results

A folder named --help

Possible Solution

Logs / Screenshots

https://github.com/user-attachments/assets/f6904342-a17c-4b7a-967a-21d282395dda

LEFTHOOK_VERBOSE=true git ...
mrexox commented 1 month ago

Hey! Could you share your lefthook.yml config?

sawa-ko commented 1 month ago

Hi @mrexox, here my lefhook.yml file

pre-commit:
  parallel: true
  commands:
    check:
      glob: "*.{ts,tsx}"
      run: npx lint-staged --allow-empty && git update-index --again

commit-msg:
  scripts:
    "commitlint.sh":
      runner: bash

post-commit:
  commands:
    git-update-index:
      run: git update-index --again
mrexox commented 1 month ago

Thank you. Could you please show what this git command displays?

git rev-parse --git-path hooks

I assume that hooks path may be configured the wrong way, because this bug does not reproduces for my local setup.

sawa-ko commented 1 month ago

Hi @mrexox, the response of the command is this:

image

mrexox commented 1 month ago

@sawa-ko , I think you should setup your hooksPath setting for the project or globally.

Consider chaning --local to --global if the setting is global. I think that this configuration may be either in yout ~/.gitconfig or in your project's .git/config file.

git config --local core.hooksPath .git/hooks/