Launch a Website with a Custom URL using Github Pages and Google Domains
Domain Name: $12/year
Live Site: connorleech.info
Step 1: Buy your domain at Google Domains
Google Domains - Google
Search for and register a domain, get hosting, and build a site with Google Domains. The best of the internet backed by…
In my case I got connorleech.info.
Step 2: Create a Static Website
Create a custom blog theme with Hexo.js
You can do some really fancy stuff with this. I wrote a separate post about how to Create a custom blog theme with Hexo.js. For the purposes of this tutorial we’ll Keep It Short and Simple (KISS) by deploying a “hello world” HTML site.
$ mkdir YOUR_GITHUB_USERNAME.github.io
$ cd YOUR_GITHUB_USERNAME.github.io
$ touch index.html
Then make you’re super awesome website. Paste the following into index.html. If you are feeling adventurous you could paste some of the sites from HTML5 UP. It’s your website so I’ll leave that up to you!
Create a git repo and commit your code:
$ git init
$ git add -A
$ git commit -m 'initial commit'
$ git statusOn branch master
nothing to commit, working tree clean
Step 3: Create the Repo on Github.com
Click the plus icon in top right and then ‘New Repository’
Step 4: Link your local code to the github repo
Once the repo is created on github we need to connect it to our local files that we created in Step 2. Get the remote url:
Add that as the remote to your local git repo. It will be called origin and that links to github. You can have multiple remote and push to different place (like heroku) using git.
$ git remote add origin https://github.com/connor11528/connor11528.github.io.git$ git remote -vorigin https://github.com/connor11528/connor11528.github.io.git (fetch)
origin https://github.com/connor11528/connor11528.github.io.git (push)$ git push origin masterCounting objects: 58, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (57/57), done.
Writing objects: 100% (58/58), 962.02 KiB | 0 bytes/s, done.
Total 58 (delta 2), reused 0 (delta 0)
remote: Resolving deltas: 100% (2/2), done.
* [new branch] master -> master
Then you only have to wait a couple minutes and your site will be live! Thank you Github Pages. Head to YOUR_GITHUB_USERNAME.github.io to see the live version of your website.
Step 5: Add CNAME file
$ touch CNAME
In my case my domain is connorleech.info so my CNAME file looks like:
Then add the changes to git and push them to your repo.
$ git add -A
$ git commit -m 'add CNAME file'
$ git push origin master
Step 6: Configure DNS for Google Domain
Over at https://domains.google.com/registrar head to the “Configure DNS” tab and scroll to the “Custom resource records” section at the bottom of the page.
You need to add two “@” type A records that point to the GitHub ips 126.96.36.199and 188.8.131.52 and one “www” CNAME record that points to your USERNAME.github.io url
How to point a domain on Google Domains to GitHub pages · Curtis Larson's Blog
Tutorial on pointing a domain on Google Domains to GitHub pages
Thank you Curtis Larson (@QuackWare) for figuring this one out!
I was only able to add the one Github domain without an error so it ended up looking like this:
If you enjoyed the tutorial please give it a recommend! Thanks again
🚀 If you’re a candidate on the job market or startup looking to hire in the Bay Area, feel free to create a profile on Employbl 🤝