Skip to content

Instantly share code, notes, and snippets.

@buddhike
Created June 10, 2017 08:58
Show Gist options
  • Save buddhike/38e54ac15233bb28538c4b094d024fa6 to your computer and use it in GitHub Desktop.
Save buddhike/38e54ac15233bb28538c4b094d024fa6 to your computer and use it in GitHub Desktop.
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment