buddyspike
6/10/2017 - 8:58 AM

init hugo repo for deployment

init hugo repo for deployment

#!/bin/bash

set -e

REPO=$1
REMOTE=$(git remote -v | grep upstream | grep -v grep | cat)

if [ -z $REMOTE ]
then
  if [ -z $REPO ]
  then
    echo "Must specify a valid upstream repo."
    exit 1
  fi
  echo "Upstream not set. Setting it now..."
  git remote add upstream $REPO
fi


git checkout --orphan gh-pages
git reset --hard
git commit --allow-empty -m "Initializing gh-pages branch"
git push upstream gh-pages
git checkout master