I have a setup where tshepang.github.com redirects to tshepang.net, and have set up my A record to point to 204.232.175.78 (as explained). It works well.

Now, I want to have a subdomain, so I can have a CNAME record pointing to movies.tshepang.net. Since tshepang.github.com is already taken, I don't know how to do it, short of creating another GitHub account.

Yes, it is possible to have multiple GitHub Pages sites within one account. Create another GitHub repository and push your site files to the gh-pages branch. This would result in the site being hosted at tshepang.github.io/<repo-name>.

Now, push another file "CNAME" to the same repository and branch and fill it with movies.tshepang.net. Log in to your DNS host and add the CNAME to point to "tshepang.github.io" (just like the original site).

This would allow you to have seemingly two different sites on different domains. This would not work for having two or more sub-domains within github.io itself.

  • Why the limitation, ...would not work for having two or more sub-domains within github.com itself? Is there a reference somewhere? – Tshepang Apr 3 '13 at 14:10
  • 1
    I can't really find anything that explains it, I only found out through experience. You can try creating another repository with another sub-domain and see if it works. – Hydra Apr 5 '13 at 10:51
  • I've tried with 9 sub-domains, and it works. It takes a while though... several minutes for each sub-domain. – Tshepang Apr 14 '13 at 11:22
  • @Tshepang Wow, you just created the respective repositories and it all works? – Hydra Apr 14 '13 at 11:23
  • yes sir, indeed it does – Tshepang Apr 14 '13 at 11:24
up vote 1 down vote accepted

As mentioned, for each site that would end up accessible as a sub-domain:

  • I need to create a separate GitHub repository
  • Ensure to have the desired site url in the CNAME
  • git push the site onto gh-pages branch

To make those sites accessible from the internet, my settings look like this:

enter image description here

Now, movies.tshepang.net takes me to one site, demo-icbu.tshepang.net takes me to another, and so on.

  • 2
    Sorry, how is this different from my answer? I am referring to having domains like foo.github.io AND bar.github.io all under a single account. You can have unlimited sub-domains if you use your own domain name and add the relevant CNAMES. – Hydra Apr 14 '13 at 12:58
  • Using the web interface, I could not get CNAMEs to work. By add relevant CNAMES, do you mean the text files required by GitHub? Also, I don't understand what you mean by foo and bar... I thought one can only have one of either (in my case tshepang.github.io). – Tshepang Apr 14 '13 at 21:23
  • Is there maybe a video tutorial explaining this. Does it work for multiple sites as opposed to subdomains and multiple sites that might include a subdomain too? site.com, site2.com, sub.site2.com etc etc? – Pierce McGeough Jan 17 at 20:01

I know that this is answered for some time already, but you can even have multiple pages within the same repository. See my answer on Stackoverflow - https://stackoverflow.com/a/41879114/1297835

Your Answer

 

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.