Adding domain for your github project
20 Sep 2016I have a problem. Each time I want add domain to my custom github project I forget what I should do exactly. That’s why I want to post this SO answer in my blog. I hope it would helpful not only for me.
To Setup a custom domain for your gh-pages
project repo that handles
www.yourdomain.com
and yourdomain.com
(assumes you already have a gh-pages
branch on your repo) you need this:
- From your project repo,
gh-pages
branch. Create aCNAME
file with the contentsyourdomain.com
. - In your DNS manager, setup two
CNAME
records. One for the root apex (@
) and one forwww
. Both point toYOURusername.github.io
. If your DNS provider does NOT supportALIAS
records on the root apex (@
), simply createA
records that point to192.30.252.153
and192.30.252.154
.
After that wait til your name servers update:
dig yourdomain.com +nostats +nocomments +nocmd
Original link: stackoverflow.com/a/9123911