I'm trying to set up Git for staging my website so that I can git pull
to get the current version to work on locally and then git push
to push the changes to the remote server. I've got it set up so that it works the way I want it to, but after I push, I have to manually run git checkout -f
or git reset --hard HEAD
on the remote server.
I've tried putting these into a shell script as the post-receive hook on the server, but it just doesn't seem to have any effect. I know that the script is running because I'm seeing "Changes pushed to server" after I push. Here's the post-receive hook:
#!/bin/sh
git reset --hard HEAD
echo "Changes pushed to server."
Thanks.