How to — Host your static website (with a custom domain) on GitHub Pages
by Laurel on 9.23.2021

Note this was originally created in 2020, so there might be a few things out of date. Feel free to let me know, and I’ll try and update them!

 

This guide assumes you…

  • Already have created your site. It should live in a folder (named all lowercase without any spaces) with at minimum an index.html inside of it
  • make sure to change your folder name from “starter-kit” to one of your choosing
  • Have a domain name purchased

Here are some pros and cons of using GitHub as your host 🙂

 

General steps:

  1. Create a GitHub repository

  1. Enable GitHub Pages for the repository

  1. Connect your domain to GitHub Pages

  1. Test making a change to your code, pushing it to GitHub, and seeing your site update

Onward …

 

1. Create a GitHub repository


Open up GitHub Desktop app on your computer

At the left menu, click the “Add” button and scroll to “Add an existing repository…”
Choose the path of the folder where you made your site.

Once you do, you’ll get a small message that says:

This directory does not appear to be a Git repository. Would you like to create a repository here instead?

Click the link create a repository”.

Then you’ll get a new form. You don’t need to change anything, just press the blue button “Create repository”

Optional, but good to see: If you navigate in your file directory / Finder and open up the folder where your microsite lives, you should see an invisible folder titled “.git.” If you don’t see the invisible folder, try using the shortcut to show / hide invisible files: command + shift + .