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

@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