Error during pre-commit install --install-hooks
chillybug opened this issue · 3 comments
chillybug commented
I added below to .pre-commit-config.yaml and got error.
- repo: git://github.com/dnephin/pre-commit-golang
sha: HEAD
hooks:
- id: go-fmt
error:
pre-commit installed at .git/hooks/pre-commit
[INFO] Initializing environment for git://github.com/dnephin/pre-commit-golang.
An unexpected error has occurred: CalledProcessError: Command: ('/usr/bin/git', 'checkout', 'HEAD')
Return code: 1
Expected return code: 0
Output: (none)
Errors:
error: pathspec 'HEAD' did not match any file(s) known to git.
When I changed sha from 'HEAD' to 'master', no error occurs.
- repo: git://github.com/dnephin/pre-commit-golang
sha: master
hooks:
- id: go-fmt
Is it okay? Or is better to use revision tag?
dnephin commented
The error does not seem to be related to these hooks. It looks like you ran from a path that is not a git repo.
chillybug commented
The error seems to be caused by this change: pre-commit/pre-commit#958
pre-commit changes to allow shallow clone from pre-commit v1.15.0 which is released two days ago. :)