Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 74 You must be signed in to star a gist
  • Fork 10 You must be signed in to fork a gist
  • Save matt-bailey/bbbc181d5234c618e4dfe0642ad80297 to your computer and use it in GitHub Desktop.
Save matt-bailey/bbbc181d5234c618e4dfe0642ad80297 to your computer and use it in GitHub Desktop.
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.

@matt-bailey
Copy link
Author

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
Copy link

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
Copy link

xvxx commented Jan 17, 2020

@lindseyberlin
Copy link

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
Copy link
Author

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

@xvxx
Copy link

xvxx commented Feb 17, 2020

@ocelhay
Copy link

ocelhay commented Mar 31, 2020

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

@matt-bailey
Copy link
Author

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

@MartinDelille
Copy link

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

@thibistaken
Copy link

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

@loonylou
Copy link

loonylou commented Jun 8, 2020

The missing manual 🥇

@matt-bailey
Copy link
Author

@loonylou 😄

@garret
Copy link

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
Copy link
Author

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

@garret
Copy link

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
Copy link

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

@elsassph
Copy link

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

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

@Benjin
Copy link

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