Elena' s AI Blog

How to Host Your Blog for Free with GitHub Pages

20 Feb 2026 (updated: 20 Feb 2026) / 14 minutes to read

Elena Daehnhardt


Midjourney AI-generated art
Image credit: Illustration created with Midjourney, prompt by the author.
Image prompt

“An illustration representing cloud computing”



TL;DR:
  • Create a GitHub account, make a repository named yourusername.github.io, add Jekyll, pick a theme, write your first post in Markdown, push to GitHub, and optionally connect a custom domain. Free, reliable, and yours.

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.

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.

What You Will Need

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

If you do not have Git installed, download it from git-scm.com. The installer will walk you through the process. Once it is installed, open your terminal (Terminal on Mac, Command Prompt or Git Bash on Windows) and configure your name and email — Git uses these to label your commits:

git config --global user.name "Your Name"
git config --global user.email "you@example.com"

Now clone your new repository to your computer. This creates a local copy of the repository folder that you can work in:

git clone https://github.com/yourusername/yourusername.github.io.git
cd yourusername.github.io

Step 4: Install Jekyll

Jekyll is a static site generator written in Ruby. It takes your Markdown posts, your templates, and your configuration, and builds them into a complete website ready to publish.

First, install Ruby if you do not have it. The best way depends on your operating system:

  • Mac: Ruby comes pre-installed, but I recommend using rbenv to manage versions cleanly.
  • Windows: Use RubyInstaller, which includes everything you need.
  • Linux: Install via your package manager, for example sudo apt install ruby-full on Ubuntu.

Once Ruby is installed, install Jekyll and Bundler (a tool that manages Ruby dependencies):

gem install jekyll bundler

Now create a new Jekyll site inside your repository folder. The --force flag tells Jekyll it is okay to use a folder that already exists:

jekyll new . --force

Jekyll will create all the files it needs: a _config.yml configuration file, a Gemfile listing dependencies, a _posts folder for your blog posts, and some default layout files.

Install the dependencies listed in your Gemfile:

bundle install

And start a local preview server to see your blog running on your own machine:

bundle exec jekyll serve

Open your browser and go to http://localhost:4000. If everything is working, you will see a default Jekyll blog with a placeholder post. It is not much to look at yet — but it is yours, and it is running!

Step 5: Choose and Apply a Theme

The default Jekyll theme (called Minima) is clean and functional, but there are hundreds of free Jekyll themes available if you want something with more personality. A few good places to browse:

Most themes come with their own installation instructions, but the general pattern is the same. Open your Gemfile and add the theme as a dependency:

gem "jekyll-theme-yourtheme"

Then open _config.yml and set the theme:

theme: jekyll-theme-yourtheme

Run bundle install to install the new theme, then restart the preview server with bundle exec jekyll serve and refresh your browser to see the change.

Some themes require a little more configuration — extra fields in _config.yml, or specific layouts for your posts. The theme’s README file on GitHub will tell you what is needed. I find it worth taking ten minutes to read through it before getting started.

If you are not sure where to begin, I started with Minima and then moved to a more personal theme as I got comfortable. There is no rush — you can always change it later, and the branch-based testing technique I wrote about recently is perfect for trying themes without risk.

Step 6: Personalise Your Configuration

Open _config.yml and fill in the details that describe your blog. At minimum, update these fields:

title: "Your Blog Title"
description: "A short description of what your blog is about"
author: "Your Name"
url: "https://yourusername.github.io"
baseurl: ""

The baseurl field should be empty ("") for a personal user site publishing at the root domain. Save the file and restart the preview server to see your changes.

Step 7: Write Your First Post

Blog posts in Jekyll live in the _posts folder and are written in Markdown — a lightweight text format that is easy to learn and pleasant to write in. Jekyll requires a specific filename format so it knows when to publish each post:

YYYY-MM-DD-your-post-title.md

For example: 2026-02-20-hello-world.md.

Create that file in your _posts folder and add a front matter block at the top — this is a small section of metadata that Jekyll reads to know how to handle the post:

---
layout: post
title: "Hello, World!"
date: 2026-02-20
---

This is my first blog post. I am hosting it on GitHub Pages and I am rather pleased about it.

Writing in Markdown is straightforward. You can make text **bold** or *italic*, create lists, add links, and include code blocks — all with simple, readable syntax.

Save the file and check your local preview at http://localhost:4000. Your post should appear on the front page. That feeling never really gets old, in my experience!

Step 8: Publish to GitHub

When you are happy with how things look locally, it is time to push everything to GitHub. This is the step that makes your blog live on the internet:

git add .
git commit -m "Initial blog setup with first post"
git push origin main

GitHub will detect that you have pushed a Jekyll site and automatically build it. After a minute or two, your blog will be live at https://yourusername.github.io. Every time you push new commits — whether a new post, a design tweak, or a configuration change — GitHub rebuilds the site automatically. It is a genuinely lovely workflow once you are used to it.

Step 9: Connect a Custom Domain (Optional)

If you have a custom domain — say yourblog.com — you can connect it to your GitHub Pages site in just a few steps. You will need access to your domain registrar’s DNS settings (wherever you bought the domain: Namecheap, GoDaddy, Google Domains, and so on).

In your DNS settings, create the following records. For an apex domain (yourblog.com), add four A records pointing to GitHub’s servers:

185.199.108.153
185.199.109.153
185.199.110.153
185.199.111.153

If you want www.yourblog.com to work too, add a CNAME record pointing www to yourusername.github.io.

In your repository, create a file called CNAME (no extension) in the root folder containing just your domain name:

yourblog.com

Commit and push this file to GitHub. Then go to your repository’s Settings → Pages and enter your custom domain in the Custom domain field. Check the Enforce HTTPS box once it appears — GitHub will provision a free SSL certificate for you automatically.

DNS changes can take anywhere from a few minutes to 48 hours to propagate globally, so do not worry if it does not work immediately. Once it does, yourblog.com will serve your GitHub Pages site, and the old yourusername.github.io URL will redirect to it automatically.

Keeping Things Going

Publishing your first post is the exciting part, but the real joy of a personal blog is building it up over time. A few habits I have found useful:

Writing posts locally with bundle exec jekyll serve running means you always see exactly what your readers will see before anything goes live. Committing and pushing regularly — even for small changes — keeps your repository history clean and makes it easy to roll back if something goes wrong. And if you ever want to experiment with a new design without risking your live site, the branch and repository techniques I covered in my recent posts are exactly the right tool for that.

You Are Ready

I know this post covers a lot of ground, and it probably looks more complicated than it really is. In practice, once you have done it once, the whole setup takes less than an hour. And then you have a blog that is fast, free, version-controlled, and entirely yours — no subscription, no server, no surprises.

If you get stuck at any step, the Jekyll documentation and the GitHub Pages documentation are both excellent. And of course, feel free to leave a comment or get in touch — I am always happy to help someone get their blog off the ground.

Good luck, and I hope to read your first post soon!

Did you like this post? Please let me know if you have any questions or if there is anything I should add or clarify!

desktop bg dark

About Elena

Elena, a PhD in Computer Science, simplifies AI concepts and helps you use machine learning.

Citation
Elena Daehnhardt. (2026) 'How to Host Your Blog for Free with GitHub Pages', daehnhardt.com, 20 February 2026. Available at: https://daehnhardt.com/blog/2026/02/20/how-to-host-your-blog-for-free-with-github-pages/
All Posts