Changing a Github User pages site with a custom URL to a project site

(Github’s pages guide can be found here http://pages.github.com/)

This blog is built and deployed with Octopress to a Github repository. Previously the repository was a Github User pages site, the now defunct https://github.com/rnsloan/rnsloan.github.com, along with the custom URL rnsloan.com.

While I wanted to continue serving this blog with the custom URL I wanted the ability to serve other projects from the account with Github pages branches from the standard Github pages URL http://rnsloan.github.io/repository. This was not possible with this setup as any request to rnsloan.github.io would forward to rnsloan.com because of the Github User pages site.

To change this I had to do the following:

Changed the repository from a user site to a project site by going to the projects’ settings page and renaming it.

Github project settings page

While in Github, took note of the projects’ new SSH Clone URL git@github.com:rnsloan/blog.git.

Github SSH clone url

Went to the Octopress project on my computer and edited _config.yml changing the url from http://rnsloan.github.io to http://rnsloan.github.io/blog

From the root of the project re-ran

1
rake setup_github_pages

providing the new SSH Clone URL git@github.com:rnsloan/blog.git.

Ran

1
2
rake generate
rake deploy

If are having problems with the path to resources, e.g. CSS files, try manipulating the line that sets the site root in _config.yml

1
root: /

The blog is now still served from the Custom URL but other account projects can have their pages branches accessed at http://username.github.io/repository.