Git gui and command line - hook handling error

485 views Asked by At

I am facing the different kind of situation in using Git Hooks. I have created the pre-commit file in hook directory to increment my version number on every commit. I have no problem in hook as it working fine. But the problem is the starting line i.e.

#!bin/sh

If hook contains this line then GIT GUI shows an error message while committing as:

C:/Program Files/Git/bin/sh.exe: git Project/.git/hooks/pre-commit: bin/sh
      "bad interpreter: No such file or directory"

and if I remove the above line then GIT Command line shows the error message as:

error: cannot spawn .git/hooks/pre-commit: No such file or directory 

As, our Developer team using both methods for commits and its impossible for developer to check/correct the hook everytime. Is there any alternate solution to increment the version number in the version file? or Way to resolve the issue..?

1

There are 1 answers

0
eloyesp On BEST ANSWER

You wrote #!bin/sh so I feel that you are missing the first /.

It should be:

#!/bin/sh

Hope this helps.