How to setup google domain for your fastpages site (or GitHub Pages)
a tutorial about setting up google domain for GitHub Pages
- Introduction
- Step 1. Setup in your Github Repo
- Step 2. (Optional) You can skip this step if you are NOT using a site generator, such as fastpages, or Jekyll
- Step 3. Let your custom domain point to your GitHub Pages
- Step 4. Enable HTTPS for you GitHub Pages
- Reference
Introduction
When you publish a site with GitHub Pages, the default address will look something like this: https://<username>.github.io/<repo name>
. For example, https://intodeeplearning.github.io/blog.
If you’d like to replace the default address with your custom domain, such as https://intodeeplearning.com , follow this tutorial!
What you will get in this tutorial
- Setting up a custom www subdomain, such as www.example.com, for your GitHub Pages
- having the apex domain, such as example.com, automatically redirect to www.example.com
What you need
- A GitHub repository ready for publishing, such as https://github.com/intodeeplearning/blog
- A purchased google domain, such as “intodeeplearning.com”
Step 1. Setup in your Github Repo
-
Go to Settings > Pages > Custom domain, and add you custom domain name, such as “www.intodeeplearning.com”
Jekyll
Step 2. (Optional) You can skip this step if you are NOT using a site generator, such as fastpages, orIf you are using fastpages.
-
Add a CNAME file in the root of your repo.
www.intodeeplearning.com
-
In _config.yml set
url
to your customwww
subdomain andbaseurl
to""
.url: 'https://www.intodeeplearning.com' baseurl: ''
-
In _action_files/settings.ini, empty
baseurl
.baseurl=
-
You can also refer to Fastpages: using a custom domain
Step 3. Let your custom domain point to your GitHub Pages
-
Go to your google domain registrar and select your domain.
-
Go to the DNS tab
-
Under the Resource records section, click Manage custom records
-
Create a CNAME record that points your www subdomain to
<your_github_username>.github.io
-
Do NOT include the repository name, such as intodeeplearning.github.io/blog. If you include your repository name in the CNAME record to your DNS provider, you’ll get the below message at your GitHub Settings > Pages > Custom domain
-
-
Create an A record that points to the IP addresses for Github Pages.
-
IP addresses in the screenshot
185.199.108.153 185.199.109.153 185.199.110.153 185.199.111.153
-
Check here if there’s an update in the IP addresses.
-
-
Open Terminal to confirm that your DNS record configured correctly
-
For CNAME records, do
dig www.intodeeplearning.com +nostats +nocomments +nocmd
-
You should get
; <<>> DiG 9.10.6 <<>> www.intodeeplearning.com +nostats +nocomments +nocmd ;; global options: +cmd ;www.intodeeplearning.com. IN A www.intodeeplearning.com. 3312 IN CNAME intodeeplearning.github.io. intodeeplearning.github.io. 3312 IN A 185.199.110.153 intodeeplearning.github.io. 3312 IN A 185.199.111.153 intodeeplearning.github.io. 3312 IN A 185.199.109.153 intodeeplearning.github.io. 3312 IN A 185.199.108.153
-
-
For A records, do
dig intodeeplearning.com +noall +answer -t A
-
You should get
;; global options: +cmd intodeeplearning.com. 928 IN A 185.199.109.153 intodeeplearning.com. 928 IN A 185.199.108.153 intodeeplearning.com. 928 IN A 185.199.110.153 intodeeplearning.com. 928 IN A 185.199.111.153
-
-
Step 4. Enable HTTPS for you GitHub Pages
-
Go to your github repository settings page, under Settings > Pages, remove your custom domain and save.
-
Then add it back and save again.
-
Now you should be able to check the Enforce HTTPS checkbox
-
Note: DNS changes can take up to 24 hours to propagate.
-
You may use dns propagation checker to check if you DNS has successfully propagated.
-
See GitHub Pages trouble shoot for more questions.
-
That’s it! Your website should be publishing at your custom domain now!
Reference
- Official Github Tutorial
-
About custom domains and GitHub Pages
We recommend always using a
www
subdomain configurations for your site. If you configure awww
subdomain, we automatically attempt to secure the associated apex domain.If you configure
www.example.com
as the custom domain for your site, and you have GitHub Pages DNS records set up for the apex andwww
domains, thenexample.com
will redirect towww.example.com
www
subdomains are the most stable type of custom domain becausewww
subdomains are not affected by changes to the IP addresses of GitHub Enterprise Cloud’s servers. - Managing a custom domain for your GitHub Pages site
- Configuring a subdomain
-