Reputation: 892
I'm new to both git and unix so please bear with. I'm trying to create a simple git post-receive hook in a repository I've setup on ec2. In the hooks folder, I have a file named post-receive that attempts to update a public site's working directory.
#!/bin/sh
echo 'hi git'
cd /home/www-data/web2py/applications/init
sudo git checkout .
sudo git pull
echo 'done'
But after a push, nothing seems to happen. The site's working directory does not get updated and when I run git log there are no signs of errors or my echo statements. I guess I'm missing something? Thanks.
Upvotes: 5
Views: 511
Reputation: 836
First: git log is not the log of the git binary. :) It is used to see the commits and their revisions.
Do you see the "hi git" and "done" output somewhere? My guess is that your hook is not executable. Run chmod +x your_hook
- This will make it executable.
Upvotes: 4