How to Host Your Blog for Free with GitHub Pages
A little while ago, a friend asked me how I host this blog. When I told her it was free, ran on GitHub, and I had never paid a hosting bill for it, she did not quite believe me. I completely understand that reaction — it sounds too good to be true. But GitHub Pages is genuinely one of the best-kept secrets for anyone who wants a personal blog or website without the overhead of managing a server or paying for hosting every month.
In this post I want to walk you through everything from scratch: creating a GitHub account, setting up your blog with Jekyll, choosing a theme, writing your first post, and connecting a custom domain if you have one. Whether you have never used Git before or you are a developer who just has not gotten around to setting up a personal site, I hope this gives you everything you need to get started.
What Is GitHub Pages, Exactly?
GitHub Pages is a free hosting service built into GitHub. You store your website files in a GitHub repository, and GitHub automatically builds and serves your site at a public URL. There is no server to configure, no database to manage, and no hosting plan to pay for.
GitHub Pages represents a static-site hosting model that builds and serves a Jekyll site directly from a Git repository, eliminating dedicated servers, databases, and monthly hosting fees.
The URL GitHub gives you by default looks like yourusername.github.io, which is already a perfectly respectable address for a personal blog. And if you want a custom domain like yourblog.com, you can connect one with a few small configuration steps — more on that later.
GitHub Pages works best with static sites — websites built from plain files like HTML, CSS, and Markdown, with no server-side code running. For a blog, this is ideal. Jekyll is the tool that turns your Markdown posts and templates into a complete static website, and it is the one I use and recommend. That said, if you prefer a different static site generator — Hugo, Eleventy, Astro — GitHub Pages will work with those too, though the setup steps will differ a little from what I describe here.
Prerequisites for GitHub Pages: Git, Ruby, and a GitHub Account
Before we start, make sure you have these three things:
- A GitHub account (free — we will create one in the first step)
- Git installed on your computer
- Ruby installed on your computer (Jekyll runs on Ruby)
Do not worry if the last two sound unfamiliar. I will point you to the right places to get them set up.
Step 1: Create a GitHub Account
If you do not already have one, go to github.com and sign up for a free account. Choose your username thoughtfully — it will become part of your blog’s default URL (yourusername.github.io), so something close to your name or blog identity works best.
Once you are signed in, you are ready to create your blog’s home.
Step 2: Create Your Repository
In GitHub, a repository (or “repo”) is where all your blog’s files live. For GitHub Pages to publish your personal site at yourusername.github.io, the repository must be named in a very specific way: exactly yourusername.github.io, replacing yourusername with your actual GitHub username.
Click the + icon in the top right corner of GitHub and choose New repository. Set the name to yourusername.github.io, make sure it is set to Public, and click Create repository.
That is your blog’s home on GitHub. Now let us get Git set up on your computer so you can push files to it.
Step 3: Install Git and Clone Your Repository
🔒 Subscribe to keep reading.
Step 4: Install Jekyll
🔒 Subscribe to keep reading.
Step 5: Choose and Apply a Theme
🔒 Subscribe to keep reading.
Step 6: Personalise Your Configuration
🔒 Subscribe to keep reading.
Step 7: Write Your First Post
🔒 Subscribe to keep reading.
Step 8: Publish to GitHub
🔒 Subscribe to keep reading.
Step 9: Connect a Custom Domain (Optional)
🔒 Subscribe to keep reading.
Common GitHub Pages Errors and Fixes
🔒 Subscribe to keep reading.
Maintaining a GitHub Pages Blog: Ongoing Workflow
🔒 Subscribe to keep reading.
GitHub Pages Setup: Summary and Next Steps
🔒 Subscribe to keep reading.