Subdomain of website for Github pages project
Asked Answered
C

1

52

I have a Github project, github.com/jeti/matrix, and I set up a "Github pages" site for the project so that it is accessible here jeti.github.io/matrix/.

That is all configurable through Github.

Now, I would like to add a subdomain of my personal website so that the website is accessible via the subdomain matrix.jeti.io of my website jeti.io.

I am just really confused how to do that because the documentation don't seem to show how to redirect a project page to a subdomain. I have tried a few permutations of what I think should be the correct inputs, but because these DNS changes take so long to propagate, it is really hard to test.

Specifically, I would like to know what value to enter into Github as the Custom domain (it seems to me that this should simply be the subdomain matrix.jeti.io, but I am not sure, so I have left this blank):

enter image description here

Then I also need to create the subdomain. I bought the domain through OVH, and they provide a few options for adding a DNS entry:

enter image description here

My understanding is that I need to add 2 apex records. I did that already:

enter image description here

What is unclear to me is whether I also need to add a CNAME entry. This is what the form looks like when I try to add a CNAME entry:

enter image description here

So in recap:

  1. I did not specify the Custom Domain on the Github site.
  2. I created the 2 apex records shown above.
  3. I did not create a CNAME entry.

Please tell me which of these steps needs to be changed and how to modify it.

Coney answered 27/9, 2017 at 19:35 Comment(0)
C
50

After more trial and error, the answer seems to be

  1. The Github custom domain should indeed be matrix.jeti.io enter image description here

  2. I did not need the apex records. In fact, Github emailed me discouraging it. So I deleted the apex records.

  3. In OVH, I added a DNS CNAME entry like this:

enter image description here

The thing that was confusing me is that I thought that the CNAME entry needed to have a link to the original Github pages WITH the project name jeti.github.io/matrix. That was wrong. The target is simply jeti.github.io. (Note the period on the end).

Coney answered 28/9, 2017 at 5:1 Comment(6)
So if I have my custom domain example.com I should add a CNAME to username.github.com and on github set the custom domain to example.com. Right? I didn't used /docs, but gh-pages branchFeltner
Let's suppose you have 2 repositories you wanna host: jeti.github.io/matrix and jeti.github.io/vector. How will you configure your CNAME records to map them respectively to matrix.jeti.io and vector.jeti.io ?Jannajannel
@RedaDrissi I know it's three years since you wrote this, but it might help future readers so - You don't configure the CNAME records. This has to be configured on github in the cname file.Macedo
It is not clear to me what tweak you are suggesting. Perhaps it would be good to write a lengthier answer with your suggestionConey
I have the same question as @RedaDrissi , I made it work in Route 53 for my github project with just username.github.io without the project name as OP suggested, but would like to understand better about how it works for potential different project. So if I have another gh page project vector, do I just set CNAME in it as vector.mydomain.com and also set just username.github.io in DNS without the project name, and it will work?Sacring
@LoganYang Yes, it should work. As far as I know, in your DNS you only set a translation (CNAME) for vector.mydomain.com -> username.github.io. After that, it's Github itself who directs your request to your project site. That's why you also need a CNAME file inside your repo.Adelaidaadelaide

© 2022 - 2024 — McMap. All rights reserved.