I have a GitHub repository set up to host a small static site. The repository that hosts this is in the following format:


This repository is setup to use a custom domain and has a CNAME file to do so properly. This repository works exactly as expected.

Now I want to set up a project page and utilize the gh-pages branch for a different repository. When I do this, though, the CNAME in the first repository seems to apply and I am redirected to example.com/REPOSITORYNAME instead of using the expected username.github.io/projectname associated with this separate repository.

How can I continue to use the username.github.io repository with a custom domain and the gh-pages branch on a different repository without redirecting the gh-pages repository to the custom domain defined in the first repository?


One solution would be to rename your username.github.io repository to something else, so it is no longer considered to be your special "user/organization pages" repository. It can continue using the custom domain it's already on (just make sure the CNAME file in the repository correctly points to your example.com custom domain). Then, your projects pages should start using username.github.io instead of the custom example.com.

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.