Hi.
Im using Gitlab server in a VPS and i configured this hook:
#!/usr/bin/env bash
while read oldrev newrev ref
do
DATE=`date '+%Y-%m-%d %H:%M:%S'`;
if [[ $ref =~ .*/master$ ]];
then
echo $DATE >> logProd.txt
git --work-tree=/home/testGit --git-dir=/var/opt/gitlab/git-data/repositories/Synaptic/DesktopVirtual.git checkout -f master
echo "Master ref received. Deploying master branch to production...">> logProd.txt
fi
if [[ $ref =~ .*/desarrollo$ ]];
then
echo $DATE >> logDevelop.txt;
echo "Desarrollo ref received. Deploying develop branch to develop...">> logDevelop.txt
fi
if [[ $ref =~ .*/testing$ ]];
then
echo $DATE >> logTesting.txt;
echo "Testing ref received. Deploying testing branch to testing...">> logTesting.txt
git --work-tree=/home/testGit --git-dir=/var/opt/gitlab/git-data/repositories/Synaptic/DesktopVirtual.git checkout -f testing
echo "Testing ref received. Deploying finished">> logTesting.txt
fi
done
Im trying to copy files from Git Repository to folder. The “echo” work correctly, but “git -work…” never execute.
Do you know why?
Thanks you so much.