Launch a Website with a Custom URL using Github Pages and Google Domains

Hosting: Free.
Domain Name: $12/year
Live Site: connorleech.info
Step 1: Buy your domain at Google Domains
In my case I got connorleech.info.
Step 2: Create a Static Website
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!
<!DOCTYPE html>
<html>
<head>
<title>Connor's Website</title>
</head>
<body><h1>Hello Internet!</h1>
<p>This is a paragraph.</p>
<script>alert('Random Javascript!');</script>
</body>
</html>
My github username is connor11528 so my github repo is connor11528.github.io.
Create a git repo and commit your code:
$ git init
$ git add -A
$ git commit -m 'initial commit'
$ git status
On 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 -v
origin https://github.com/connor11528/connor11528.github.io.git (fetch)
origin https://github.com/connor11528/connor11528.github.io.git (push)
$ git push origin master
Counting 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.
To https://github.com/connor11528/connor11528.github.io.git
* [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:
connorleech.info
www.connorleech.info
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 192.30.252.153and 192.30.252.154 and one “www” CNAME record that points to your USERNAME.github.io url
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:

Finally your site is now live! Check it out. Mine is online at http://connorleech.info/ or connor11528.github.io will redirect to it!
Posted from my blog with SteemPress : http://selfscroll.com/launch-a-website-with-a-custom-url-using-github-pages-and-google-domains/
This user is on the @buildawhale blacklist for one or more of the following reasons: