Set up custom domain name with GitHub pages

Intro

The whole process for various situations is described in GitHub documentation. This is just a reminder for myself how to properly configure top-level apex domain redirect with GitHub Pages.

All of your <username>.github.io or <orgname>.github.io pages will be redirected to the new custom domain, so your project pages can benefit from this automatically. If you already have a project page like <username>.github.io/projectname, this will become <custom.domain>/projectname.

Sequence of actions

Let’s say you own domain.com for the sake of example, and your github username is yourname.

On GitHub

Create a repository with name <username>.github.io or <orgname>.github.io depending on the repo type.

Create a repo yourname.github.io add a file called CNAME with the following contents to the root directory:

domain.com
www.domain.com

If you prefer the name with www prefix, put it at the top. Commit and push. That’s it with github.

At DNS provider config

Add an A record:

name: @
type: A
TTL : 1h
data: [185.199.108.153, 185.199.109.153, 185.199.110.153, 185.199.111.153]

Add a CNAME record:

name: www
type: CNAME
TTL : 1h
data: yourname.github.io

With domains.google.com this looks like the following:

domains-google-com-config-screenshot

It might take several hours for the information to propagate throughout the net and become accessible everywhere.

Principal Bioinformatics Scientist

My main research interests are data visualization and signal processing for mass spectrometry.