Here you will learn how to create and config your CNAME in your github page.
Github Pages
Github offers you the possibility to create a static webpage for your user account.
More info here or here.
Static web
To create a static web supported by github or bitbucket or gitlab, etc.
You should choose which framework do you like more (jekyll, hugo, etc).
In my case, my static website is in Jekyll, my website created as Jenazads username with the template cayman.
Domains and DNS
Once you have finished to set up your own website, you would able to change your domain (e.g. your url is username.github.io) to personalized url.
In my case, I use Amazon Route 53 service to buy a domain and dns servers.
Just login to amazon account and select Route 53.
Then, search for the domain that you looking for:
note that: .com is for commercial purpose and .org is for non-profit purpose.
Once, you registered and buyed your domain you can manage DNS and subdomains in the console:
Next, You could manage your DNS and subdomains, creates, delete subdomains as you whish.
For this example, we will work with yourdomain.com.
Custom domain git pages
Once you have bought your domain and your static web is enable already, go to your username.github.io project settings (in this case is in github, that name could be different if you use bitbucket or gitlab).
Once in settings, search for the option github pages.
Set yourdomain.com in the option custom domain or just create a CNAME file in the root folder of your website project.
Why not www ?
No www. needed. If you do put www.yourdomain.com github will figure out and redirect properly nevertheless, as explained here. The difference is yourdomain.com is a top-level domain (TLD), while www.yourdomain.com is a subdomain.
A better explanation could be found here.
Create domains and subdomains
First, Create a Record set of type A (Ipv4 Address) and set your username.github.io ip address.
Or set your Ip Address as:192.30.252.153 192.30.252.154
Then create another CNAME record redirecting www.yourdomain.com to username.github.io, the original Github blog address.
Your final dns manage must be like this:
Set Mail Service
You should be able to set up a mail service with Amazon SES o GSuite service.
I use Gsuite, so you should create an admin account in GSuite and then write the IP Addresses in your Domain in Amazon Route 53 as like below:
Notes
You can change your domain every time that you want.
Have fun :D