I'm trying to create a pre-commit hook. And I want it to interract with user. So, I've found that I can use
read -p "Enter info: " info
Or just
read info
I created a file:
pre-commit:
#!/bin/sh
read -r input
echo $input
It just should read variable and output it. But it doesn't work. I mean it doesn't work as hook. If I run it using terminal with ./.githooks/pre-commit
, everything is okay. But when I use git commit -am "Hook"
, it echos empty string and doesn't read anything. Am I doing something wrong?
Git version is 2.28.0.windows.1