Adding a check to stop pull of code if its already there

This commit is contained in:
Ric Harvey
2016-06-30 11:30:40 +01:00
parent 2a8206d602
commit 8d2f1091d1

View File

@@ -20,16 +20,19 @@ if [ ! -z "$GIT_NAME" ]; then
git config --global push.default simple git config --global push.default simple
fi fi
# Pull down code from git for our site! # Dont pull code down if the .git folder exists
if [ ! -z "$GIT_REPO" ]; then if [ ! -d "/var/www/html/.git" ]; then
rm -Rf /var/www/html # Pull down code from git for our site!
mkdir /var/www/html if [ ! -z "$GIT_REPO" ]; then
# Remove the test index file
rm -Rf /var/www/html/index.php
if [ ! -z "$GIT_BRANCH" ]; then if [ ! -z "$GIT_BRANCH" ]; then
git clone -b $GIT_BRANCH $GIT_REPO /var/www/html/ git clone -b $GIT_BRANCH $GIT_REPO /var/www/html/
else else
git clone $GIT_REPO /var/www/html/ git clone $GIT_REPO /var/www/html/
fi fi
chown -Rf nginx.nginx /var/www/html chown -Rf nginx.nginx /var/www/html
fi
fi fi
# Display PHP error's or not # Display PHP error's or not