Skip to content

Instantly share code, notes, and snippets.

@martypdx
Last active August 29, 2015 14:17
Show Gist options
  • Save martypdx/8d8e66cb9a6857b4e5ca to your computer and use it in GitHub Desktop.
Save martypdx/8d8e66cb9a6857b4e5ca to your computer and use it in GitHub Desktop.

gh-pages

Make sure you have a file called index.html. Create a branch:

$>git checkout -b gh-pages
$>git branch
master
*gh-pages

commit changes:

$>git add -A
$>git commit -m 'commit files for gh-pages'

push to origin:

$>git push -u master gh-pages

go back to master:

$>git checkout master

now when you open a broswer at: [your git user name].github.io/[repo name] your index.html will be served.

To add magic to git config to auto push update to gh-pages when master updates, see next file.

see auto-gh-pages below

# add the following two lines to the [remote "origin"] section...
push = +refs/heads/master:refs/heads/gh-pages
push = +refs/heads/master:refs/heads/master
# ...it should now look something like this
[remote "origin"]
fetch = +refs/heads/*:refs/remotes/origin/*
url = git@github.com:user/repo.git
push = +refs/heads/master:refs/heads/gh-pages
push = +refs/heads/master:refs/heads/master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment