Welcome Guest ( Log In | Register )

Outline · [ Standard ] · Linear+

 Hosting webspace using GitHub with custom domain, Is this possible?

views
     
TSMatQuasar
post Oct 31 2023, 03:56 PM, updated 3y ago

Casual
***
Validating
329 posts

Joined: Jun 2023
I see two examples:

https://github.com/binarygolf/binarygolf.github.io --> https://binary.golf

https://github.com/angch/angch.github.io --> https://angch.com

How they do it? I see there is CNAME file.

Does that mean next time we don't need to pay expensive hosting fee, just register a custom domain, and somehow point to GitHub????
cytyler
post Oct 31 2023, 04:13 PM

Casual
***
Junior Member
399 posts

Joined: Nov 2014
ChatGPT:

Here's a simplified step-by-step guide on how to do it:

Create a GitHub Repository: First, create a GitHub repository for your website. The repository name should be in the format <username>.github.io, where <username> is your GitHub username. This will make your website accessible at https://<username>.github.io.

Add Your Website Files: Add your website's HTML, CSS, JavaScript, or any other relevant files to the repository. You can also use a static site generator like Jekyll if you prefer.

Create a CNAME File: To associate a custom domain with your GitHub Pages site, create a CNAME file in the root of your repository. The CNAME file should contain your custom domain name (e.g., example.com or www.example.com).

Set Up Domain Configuration: Next, you'll need to configure your domain registrar to point to GitHub's servers. This involves setting up DNS records. You generally need to create two records: an A record pointing to GitHub's IP addresses and a CNAME record that points to <username>.github.io.

GitHub Repository Settings: In your GitHub repository, go to the "Settings" tab. Scroll down to the "GitHub Pages" section. There, you can select the custom domain you want to use. It may take a little time for DNS changes to propagate.

Secure Your Site (Optional): You can also enable HTTPS for your custom domain by using a service like Cloudflare or GitHub's built-in HTTPS support. This is important for security and SEO.
TSMatQuasar
post Oct 31 2023, 04:18 PM

Casual
***
Validating
329 posts

Joined: Jun 2023
QUOTE(cytyler @ Oct 31 2023, 04:13 PM)
ChatGPT:

Here's a simplified step-by-step guide on how to do it:

Create a GitHub Repository: First, create a GitHub repository for your website. The repository name should be in the format <username>.github.io, where <username> is your GitHub username. This will make your website accessible at https://<username>.github.io.

Add Your Website Files: Add your website's HTML, CSS, JavaScript, or any other relevant files to the repository. You can also use a static site generator like Jekyll if you prefer.

Create a CNAME File: To associate a custom domain with your GitHub Pages site, create a CNAME file in the root of your repository. The CNAME file should contain your custom domain name (e.g., example.com or www.example.com).

Set Up Domain Configuration: Next, you'll need to configure your domain registrar to point to GitHub's servers. This involves setting up DNS records. You generally need to create two records: an A record pointing to GitHub's IP addresses and a CNAME record that points to <username>.github.io.

GitHub Repository Settings: In your GitHub repository, go to the "Settings" tab. Scroll down to the "GitHub Pages" section. There, you can select the custom domain you want to use. It may take a little time for DNS changes to propagate.

Secure Your Site (Optional): You can also enable HTTPS for your custom domain by using a service like Cloudflare or GitHub's built-in HTTPS support. This is important for security and SEO.
*
Thanks mate for your answer from ChatGPT.... now I just need to find out GitHub's IP address.
Doraku
post Nov 19 2023, 01:30 PM

Old threads digger
******
Senior Member
1,155 posts

Joined: Apr 2016


To redirect Github pages to custom domain make sure to publish your website repo to Github page, on your repo pages settings enter your custom domain in the text box and click save
Attached Image

Then you need to create CNAME record to point your subdomain to your Github.io page link
Attached Image
Go back to pages settings and enable Enforce HTTPS, your custom domain should now point to your Github pages. If you wanna point your apex domain instead you need to create A and AAAA records point into Github IP instead of CNAME records, for more info how to setup A/AAAA IP check Managing a custom domain for your GitHub Pages site

This post has been edited by Doraku: Nov 19 2023, 01:30 PM

 

Change to:
| Lo-Fi Version
0.0173sec    0.72    6 queries    GZIP Disabled
Time is now: 22nd December 2025 - 09:32 AM