0%

How to bind custom domain to github page

CName file

Github uses a file called CNAME to redirect your site. If you read the official
guide it says the file must be saved under the root directory in the master branch. But remember that for us the source branch is where the raw material is and master branch is generated when you deploy. So if you put something in the master branch it will be overwritten next time you deploy your site.

Create a file called CNAME (all caps, no extension) under the source directory in the source branch and write your domain name into that file. Replace mydomain.com with your own domain.

1
2
$ cd source/
$ echo mydomain.com > CNAME

GoDaddy setup

  1. ping username.github.io and obtain your ip address

  2. add two DNS entries

Type Host Points to TTL
A @ github IP 1 hour
CNAME username.github.io @ 1 hour