Skip to content
This repository has been archived by the owner on Nov 10, 2022. It is now read-only.

install-pre-commit-hook.sh will error if "$(git rev-parse --git-dir)/hooks" doesn't exist #261

Open
mckfc opened this issue Oct 2, 2017 · 1 comment

Comments

@mckfc
Copy link

mckfc commented Oct 2, 2017

Today I try run this script on my windows machine: install-pre-commit-hook.sh and noticed it is printing some error "??? NO Such ?????" though if flashed out.

I googled how to prevent shell script cmd closing and luckily found "sleep x" could let the window stay. And finally I found the script stop after:
cd "$(git rev-parse --git-dir)/hooks"
I open .git folder in the project and can't find any hooks folder there. I think that's why "NO SUCH ???" error raised.

I created one manually there and then run the script again. Now I can find something new in the new folder.

I never delete any folder in .git folder so not sure why the hooks folder is not there. But please add following code before cd to make sure it works:
mkdir -p "$(git rev-parse --git-dir)/hooks"

@westonruter
Copy link
Contributor

What version of Git do you have? It's strange that the hooks directory is not there, as normally it contains sample hooks. Are the other files and directories in the .git directory as normal, including branches, refs, info, etc?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants