I have a post-receive
hook inside a Git repository that clones the repository into another directory and then cd
s into that directory.
#!/bin/bash --login
GIT_REPO="$HOME/oliverjash.me.git"
source "$HOME/.bash_profile"
checkout () {
BRANCH="$1"
TMP_GIT_CLONE="$2"
git clone $GIT_REPO $TMP_GIT_CLONE
cd $TMP_GIT_CLONE
git status
}
checkout master "$HOME/tmp/oliverjash.me"
checkout project "$HOME/tmp/project.oliverjash.me"
exit
If I run this script whilst logged in to SSH, git status
works fine. However, when the script is executed as the post-receive
hook, git status
reports this:
remote: fatal: Not a git repository: '.'
I can't understand why this is!