Gangmax Blog

自由之思想,独立之精神

Add CNAME for My Octopress Github Pages

| Comments

If you have a domain name, you can use it for your github pages. This solution basically comes from here with some minor differences.

  • Create a “CNAME” text file in your local “octopress/source” directory with your domain name in it(such as “gangmax.me”), “rake generate” and “rake deploy”. Then you should see the “CNAME” file in the “master” branch file list under the root directory from “https://github.com/your-account/your-account.github.com”.

  • Go to your domain service provider’s manangement console, add an A record like below:

1
2
3
4
5
6
7
8
~~@ = 207.97.227.245~~
# The value is the IP address of Github Pages. This step is not clear in the original solution article.
# Updated@2014-12-08, after about one month not-published problem happened, I found the root cause
# is that Github updated it's DNS configuration. I found it as the Settings section of my blog repository.
# The fix is to update the A record(s) of your domain service provider, as:
@ = 192.30.252.153
@ = 192.30.252.154
# You can run "dig your.domain.com +nostats +nocomments +nocmd" to verify if it works after about 1 hour.
  • Add another CNAME record like below as well:
1
2
www = your-account.github.com
# The value should be your github pages URL. You should replace the "your-account" with your github account.

Wait some time(half an hour or more), to let the DNS configuration take effect, then it should work.

Comments