When you are dealing with a non-bare repository, the post-commit 1 hook is launched with the current working directory of the repository working tree. So you do not need ../../ .
If you want the full path to the script, you can always do:
SCRIPT=$(readlink -nf myscript.sh)
... or you can use git rev-parse --show-toplevel to get the absolute path to the working directory:
SCRIPT=$(git rev-parse --show-toplevel)/myscript.sh
1 ... but note that this does not apply to some other hooks, for example. in a post-receive chain in a non-bare repository, the current working directory is a .git directory.
Mark longair
source share