Skip to content

Instantly share code, notes, and snippets.

@nodesocket
Last active October 31, 2017 01:02
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save nodesocket/15dba9ebbcc9e119cc3a to your computer and use it in GitHub Desktop.
Save nodesocket/15dba9ebbcc9e119cc3a to your computer and use it in GitHub Desktop.
BASE_PATH="/srv/www"
REPO_PATH="/srv/www/repo"
GIT_URL="https://github.com/username/repo.git"
if [ -d "$REPO_PATH" ]; then
cd $REPO_PATH || exit 3
git pull --quiet
echo "git pull successfully ran ($(git rev-parse --short HEAD))";
else
cd $BASE_PATH || exit 3
git clone $GIT_URL --quiet
echo "git clone successfully ran"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment