I get the error :
remote: error: cannot run hooks/post-receive: No such file or directory
When trying to push to remote. The post-receivce file exists in the correct location (testnew.git/hooks) and contains:
#!/bin/bash2 export GIT_DIR=/var/www/testnew/testnew/.git/ export GIT_WORK_TREE=/var/www/testnew/testnew/ cd /var/www/testnew/testnew/ echo "here we go..." git fetch git merge origin/master git submodule update --init --recursive
I've tried setting permissions on post-receive using:
chmod a+x post-receive
But this gives same error. Setting permission to 755 removes the error , but the script does'nt run.
This would happen if the hooks/post-receive
file exists, is marked executable, but cannot be executed. It cannot be executed, because the interpreter, /bin/bash2
, either does not exist or is not executable.
Replace the /bin/bash2
with name of bash that does exist and is executable on the server.
(The reason the error looks like this is, that the operating system only returns the error status, "No such file or directory", but does not report which file does not exist. And the code that tried to execute it does not know that the system already read hooks/post-receive
and was looking for /bin/bash2
. All it knows is it tried to run hooks/post-receive
, so that's what it prints).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With