Reputation: 2585
I use ssh to access a remote git repository. I add such a simple post-receive script in hooks directory:
#/bin/sh
REPO="$1"
REV="$2"
echo $REPO $REV >> /var/log/gitlog
I changed the code in local PC and push many times, and I saw nothing in /var/log/gitlog
. I have checked the permission of post-receive. Its file mask has been set to 777. All users can execute the script on the console.
Upvotes: 0
Views: 113
Reputation: 1324258
That may be because that hook (post-receive
) doesn't take any argument.
See gitHooks:
This hook is invoked by git-receive-pack on the remote repository, which happens when a git push is done on a local repository. It executes on the remote repository once after all the refs have been updated.
This hook executes once for the receive operation. It takes no arguments, but gets the same information as the
pre-receive
hook does on its standard input.
This answer mentions:
You have to use the
read
command.
#!/bin/sh
read oldrev newrev refname
...
Upvotes: 1