Running git command through a Phing ExecTask:
<exec command="git remote rm origin" dir="${build.src}" checkreturn="false" />
This works when phing build.setup
is executed directly from command prompt. However, the same process fails when run from a Git post-receive hook with this message:
fatal: Not a git repository: '.'
The output (see RUN_POSTRECEIVE.txt below) of this Phing command:
<exec command="{ echo $USER; pwd ; ls -l .git ; git remote rm origin; } > /tmp/git.log" dir="${build.src}" checkreturn="false" />
Shows that the command is being executed from the right location by the right user, and the .git folder exists and has git-y contents. But immediately thereafter git
complains that the folder is not a repository.
Simple solution: In post-receive hook, SSH into same host and run command: