Basically, I have a server with a git repo 'origin'. I'm trying to have another repo auto-pull from origin every time someone pushes code to it. I've been using the hooks in origin, specifically post-receive. So far, my post receive looks something like this:
#!/bin/sh GIT_DIR=/home/<user>/<test_repo> git pull origin master
But when I push to origin from another computer, I get the error:
remote: fatal: Not a git repository: '/home/<user>/<test_repo>'
However, test_repo most definitely is a git repo. I can cd into it and run 'git pull origin master' and it works fine.
Is there an easier way to do what I'm trying to do? If not, what am I doing wrong with this approach? Thanks in advance.
Edit, to clarify: The repo is a website in progress, and I'd like to have a version of it available at all times that is fully up to date.