I'm trying to setup a git repo on my live server to automatically update a subdomain on receive. Using this guide http://toroid.org/ams/git-website-howto.
hooks/post-receive
#!/bin/sh
pwd
git checkout -f
config
[core]
repositoryformatversion = 0
filemode = true
bare = false
worktree = /var/www/vhosts/domain.com/subdomains/staging/httpdocs
[receive]
denycurrentbranch = ignore
If I run git checkout -f in /var/git/domain.com.git/ it works, the subdomain is updated. However, when I push I get the following output:
/var/git/domain.com.git
fatal: This operation must be run in a work tree
I'm not sure why this works in the shell, but not in the hook. Can anyone enlighten me?