evilmartians / lefthook

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

install command doesn't work from subfolders with remote config #871

Closed ztzxt closed 5 days ago

ztzxt commented 1 week ago

:wrench: Summary

when I run lefthook install from a subfolder, it fails with exit code 128

Lefthook version

1.8.2 9996e0d9db43a6b856074d2b836adf924a24b992

Steps to reproduce

git clone https://github.com/justtrackio/lefthook-demo.git
cd lefthook-demo/subfolder
LEFTHOOK_VERBOSE=1 lefthook install

Expected results

lefthook install the hooks from remote config

Actual results

lefthook can't install the hooks from remote config

Possible Solution

Logs / Screenshots


➜  subfolder git:(main) LEFTHOOK_VERBOSE=1 lefthook install                   
│ [lefthook] cmd:    [git rev-parse --show-toplevel]
│ [lefthook] stdout: /git-repos/github/justtrackio/lefthook-demo

│ [lefthook] cmd:    [git rev-parse --git-path hooks]
│ [lefthook] stdout: ../.git/hooks

│ [lefthook] cmd:    [git rev-parse --git-path info]
│ [lefthook] stdout: ../.git/info

│ [lefthook] cmd:    [git rev-parse --git-dir]
│ [lefthook] stdout: /git-repos/github/justtrackio/lefthook-demo/.git

│ [lefthook] cmd:    [git hash-object -t tree /dev/null]
│ [lefthook] stdout: 4b825dc642cb6eb9a060e54bf8d69288fbee4904

│ Searching config in:/git-repos/github/justtrackio/lefthook-demo
│ Merging remote config: git@github.com:evilmartians/lefthook: ../.git/info/lefthook-remotes/lefthook/examples/remote/ping.yml
│ Cloning remote config repository: ../.git/info/lefthook-remotes/lefthook
│ [lefthook] cmd:    [git -C ../.git/info/lefthook-remotes clone --quiet --origin origin --depth 1 git@github.com:evilmartians/lefthook lefthook]
│ [lefthook] dir:    /git-repos/github/justtrackio/lefthook-demo
│ [lefthook] error:  exit status 128
│ [lefthook] stdout: 
│ [lefthook] stderr: fatal: cannot change to '../.git/info/lefthook-remotes': No such file or directory

Couldn't sync from git@github.com:evilmartians/lefthook. Will continue anyway: exit status 128