Skip to content

Instantly share code, notes, and snippets.

@divyekapoor
Created January 9, 2016 02:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save divyekapoor/42c8904dfd8a0267945b to your computer and use it in GitHub Desktop.
Save divyekapoor/42c8904dfd8a0267945b to your computer and use it in GitHub Desktop.
Static site on Github using a custom domain
#!/usr/bin/env bash
#
# Author: Divye Kapoor (http://divye.in)
#
# This script sets up Github static pages for any repository.
# Just modify some of the lines below to specify your username and repository info
# and the script will do the rest.
# Modify these lines as per your requirements.
export GITHUB_USER=divyekapoor
export REPO_NAME=zigndog.com
export DOMAIN=zigndog.com
# Do not modify anything below.
git clone https://github.com/${GITHUB_USER}/${REPO_NAME}.git
cd ${REPO_NAME}
git checkout -b gh-pages
echo Welcome to ${DOMAIN} > index.html
echo ${DOMAIN} > CNAME
git commit -am 'Set up github pages.'
git push -u origin gh-pages
echo "Github pages set up. You are on the gh-pages branch."
echo "You may modify index.html to suit your needs."
echo "Publish new files to github with:"
echo ' $ git push origin gh-pages'
echo
echo "Check out: http://${GITHUB_USER}.github.io/${REPO_NAME} for the published files."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment