Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
How to set up DNS records on gandi.net to use a custom domain on Github Pages

How to set up DNS records on gandi.net to use a custom domain on Github Pages

You would think it would be easy to find this information, but none of the Github or Gandi documentation is clear so I have recorded the required steps here.

Create the following A records:

@ 1800 IN A 185.199.108.153
@ 1800 IN A 185.199.109.153
@ 1800 IN A 185.199.110.153
@ 1800 IN A 185.199.111.153

Remove the Gandi parking page A record:

@ 10800 IN A 217.70.184.38

Create the following CNAME record:

www 10800 IN CNAME [github-username].github.io.

Remove the Gandi parking page CNAME record:

www 1800 IN CNAME webredir.vip.gandi.net.

Finally, in your Github repo create a file called CNAME which contains your Gandi domain name, e.g. [my-domain].io.

@Maxlemaitre

This comment has been minimized.

Copy link

@Maxlemaitre Maxlemaitre commented May 2, 2019

I'm surprised to see how straightforward it is. Their documentation are ridiculously unclear. Thanks man!

@marcrowindo

This comment has been minimized.

Copy link

@marcrowindo marcrowindo commented Oct 25, 2019

This is borderline ridiculous. It really works just like this. Thank you sir!

@MartinDelille

This comment has been minimized.

Copy link

@MartinDelille MartinDelille commented Dec 4, 2019

Why do we need to create the following A records?

@ 1800 IN A 185.199.108.153
@ 1800 IN A 185.199.109.153
@ 1800 IN A 185.199.110.153
@ 1800 IN A 185.199.111.153
@matt-bailey

This comment has been minimized.

Copy link
Owner Author

@matt-bailey matt-bailey commented Dec 4, 2019

I'm no expert, but I believe A records are for mapping domain names to IP addresses, so the four IP addresses above all belong to gandi.net.

@MartinDelille

This comment has been minimized.

Copy link

@MartinDelille MartinDelille commented Dec 16, 2019

My config work with the single following A field:

@ 10800 IN A 217.70.184.38

I had problem with the redirection but I contacted gandi support and it is now fixed (without really understanding what happened...).

@xvxx

This comment has been minimized.

Copy link

@xvxx xvxx commented Jan 17, 2020

@lindseyberlin

This comment has been minimized.

Copy link

@lindseyberlin lindseyberlin commented Feb 16, 2020

Hi! Would you mind providing sources as to why you use those specific IP addresses, etc? I'm looking around in the Gandi and GitHub documentation trying to follow along, I get why you might want to set up multiple A IP addresses, I'm just wondering how you found those specific IPs and went with this specific setup.

(For context, I'm trying to refresh my old website that I set up years ago and now can't remember anything as to why I had things set up the way I did... Typical haha)

@matt-bailey

This comment has been minimized.

Copy link
Owner Author

@matt-bailey matt-bailey commented Feb 17, 2020

@lindseyberlin No problem - I simply contacted their customer support team and these were the instructions they gave me (via email).

@xvxx

This comment has been minimized.

Copy link

@xvxx xvxx commented Feb 17, 2020

@ocelhay

This comment has been minimized.

Copy link

@ocelhay ocelhay commented Mar 31, 2020

Can you confirm that the CNAME should end with github.io and not github.com?

@matt-bailey

This comment has been minimized.

Copy link
Owner Author

@matt-bailey matt-bailey commented Apr 1, 2020

@ocelhay Yes, I believe so. Those were the instructions given me by Gandi.

@MartinDelille

This comment has been minimized.

Copy link

@MartinDelille MartinDelille commented Apr 4, 2020

@ocelhay In fact it is github.io. (don't forget the ultimate dot).

@thibistaken

This comment has been minimized.

Copy link

@thibistaken thibistaken commented May 31, 2020

Works like a charm, thanks! Trying to figure out SSL now for custom Gandi domains...

@loonylou

This comment has been minimized.

Copy link

@loonylou loonylou commented Jun 8, 2020

The missing manual 🥇

@matt-bailey

This comment has been minimized.

Copy link
Owner Author

@matt-bailey matt-bailey commented Jun 8, 2020

@loonylou 😄

@garret

This comment has been minimized.

Copy link

@garret garret commented Jul 9, 2020

Is it normal that the connection is not https? I think I have a ssl certificate with my gandi custom domain. Would it be possible to have https when connecting to my custom domain to the github page? What would be the steps in case?

@matt-bailey

This comment has been minimized.

Copy link
Owner Author

@matt-bailey matt-bailey commented Jul 9, 2020

@garret I'm not sure sorry, but perhaps @thibistaken figured it out?

@garret

This comment has been minimized.

Copy link

@garret garret commented Jul 10, 2020

@matt-bailey oh that I figure out in the end. Just look for "github custom domain gandi cloudfare" on google and there are many guides. You will need to create a free account on cloudfare.

@elsassph

This comment has been minimized.

Copy link

@elsassph elsassph commented Sep 15, 2020

What would it look like if I only want to point a subdomain to Github?

@elsassph

This comment has been minimized.

Copy link

@elsassph elsassph commented Sep 15, 2020

Figured it: I let the whole records configuration as-is and only added:

[subdomain-name] 10800 IN CNAME [github-username].github.io.
@Benjin

This comment has been minimized.

Copy link

@Benjin Benjin commented Oct 1, 2020

After following these wonderfully-simple instructions, my domain (benj.in) is directing to GH Page's 404 page, so it's getting something in the right direction but it's still missing a piece. Any ideas?

Update: Figured it out. Two mistakes: 1) my CNAME file was only in main, not over in gh-pages, 2) the file contained only benj.in, but needed to be www.benj.in

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.