Skip to content

Instantly share code, notes, and snippets.

@zgulde
Last active March 3, 2016 20:13
Show Gist options
  • Save zgulde/0ee9b53dc00b6db23a28 to your computer and use it in GitHub Desktop.
Save zgulde/0ee9b53dc00b6db23a28 to your computer and use it in GitHub Desktop.

Github Pages!

Github, in it's infinite awesomeness, will host static sites for you for free! This means we can show off all of the work yall have done thus far.

Note that we can show off all the front-end stuff we've done, but this will not work for our php files. We could totally put some php scripts on our Github page, but they will not be evaluated.

For the most part, we will follow along with The Github Pages Tutorial.

The short version of all this is that github will host whatever content you have in a repository named username.github.io at username.github.io.

Steps

  1. While technically this is not neccessary, I would strongly advise you create a new site on your vagrant box to hold your site.
    • from ~/vagrant-lamp, ansible-playbook ansible/playbooks/vagrant/site/static.yml
  2. Create a new repository on Github
    • name it username.github.io where username is your github username
    • It is very important that this repository is named correctly, otherwise this will not work!
  3. Initialize a git repository on your Mac
    • Unlike our other projects, initialize this repository in the public folder, as this is where our static content lives.
  4. Sync up and push the repository you created on your Mac to the one on Github
    • git remote add origin ...
    • git push -u origin master
  5. Visit your site!
    • go to username.github.io to see the end product!

Note

Whenever you make changes to your repository (e.g. modifying files, adding a new file) and push to master, those changes will automatically go live.

We must create our repository in the public folder because whatever is in this repository (i.e. the public folder) will be hosted.

Like our vagrant box, Github's servers will automatically point to index.html, so whatever is in this file is what will be displayed when you navigate to your site.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment