Question: how do you edit how git calls a hook?
TL;DR - my hosting platform's security is weird and I need to figure out how to edit how git calls the post-receive hook.
I'm trying to setup automatic deployment via GIT, but the main way people suggest you do that is with a post-receive script. If I cd into hooks and do
$ sh post-receive
, it works just fine, but if I
$ ./post-receive
, it will complain about permissions though it has
$ chmod 777 post-receive
(which you can check out with $ ls -l).
Here's the message I got from support: "The reason is the SSH environment is mounted in as a non-executable environment, for security reasons. This means that you can't run scripts just by the path.
As an example, running: /www/repos/webprosjekt18.git/hooks/post-receive will not work, it will give a permission error.
Running: bash /www/repos/webprosjekt18.git/hooks/post-receive will work just fine (depending on what that script does ofc, but it will at least run the file).
We think git by default run hooks by calling: /www/repos/webprosjekt18.git/hooks/post-receive which will fail. "
remote script:
mkdir repos
cd repos
git init --bare
cat > hooks/post-receive <<END
#!/bin/sh
echo "executing post-receive hook"
END
chmod 777 hooks/post-receive
cd hooks
sh post-receive