I have the following problem. I have updated the 'post-receive' to cd into a certain directory and then pull the repo in to deploy it like so:
#!/bin/bash
cd /var/www/site
git pull origin master
However whenever I do 'git push origin master' on my local machine I get the following:
Counting objects: 5, done.
Delta compression using up to 2 threads.
(etc..)
remote: fatal: Not a git repository: '.'
Yet when I manually cd to /var/www/site
and do git pull origin master
it works brilliantly.
Use unset GIT_DIR as following
You can see more information about GIT_DIR here. Git Loves the Environment
Another option is you can mention the working directory and git directory in the command.
e.g: