Deploying Octopress to Github Pages and Custom Domain

Posted by Lawrence Sun on 2013-12-20

After Set up Octopress blog, I tried to deploying it to my own subdomain.

First, create a new Github repository called “username.github.io”. e.g. I created a new repo “lawrencesun.github.io”.

Then run:

1
rake setup_github_pages

Copy URL of this new repo.

Next run:

1
2
rake generate
rake deploy

Run rake preview to see the blog at localhost:4000

Commit to source branch:

1
2
3
git add .
git commit -m "message"
git push origin source

Octopress blog could be seen through username.github.com few minutes later.

If you want to deploy it to your own domain like me,
create a new CNAME record in domain name server.

e.g. I went to DNS manage in the Godaddy, and added voice as the name, CNAME as the type and lawrencesun.github.com as the value.

When typing in the new subdomain(in my case, voice.lawrencesun.info), it will point to a Github 404.

Then run this to create a CNAME file in source directory:

echo '_yourdomain.com_(e.g. voice.lawrencesun.info)' >> source/CNAME

Finally, run rake generate and rake deploy and git commit as well.