This guide outlines the process of configuring DNS and setting up a GitHub Pages site for a custom domain.
-
Create a GitHub Repository:
- Name the repository after your domain (e.g.,
barrymister.com
ordatacraftworks.com
) for clarity. - Add a
README.md
file during initialization if desired.
- Name the repository after your domain (e.g.,
-
Enable GitHub Pages:
- Go to Settings > Pages.
- Choose the
main
branch (or another branch) and set the source directory (/root
or/docs
). - Once enabled, GitHub provides a temporary domain like
https://username.github.io/repo-name/
.
-
Add Content:
- Create an
index.md
orindex.html
file in the repository root directory. This file becomes the homepage for your site.
- Create an
-
Access the Domain DNS Settings:
- Log in to your domain host (e.g., GoDaddy, Hostinger).
- Navigate to the DNS settings for your domain (or subdomain).
-
Set Up A Records for the Apex Domain:
- Add four
A
records for the root domain (@
) pointing to GitHub’s Pages IP addresses:185.199.108.153
185.199.109.153
185.199.110.153
185.199.111.153
- Add four
-
Set Up CNAME Record for Subdomains:
- Add a
CNAME
record forwww
(or other subdomains) pointing tousername.github.io
(replaceusername
with your GitHub username).
- Add a
-
Remove Conflicting Records:
- Delete any conflicting
A
,CNAME
, orAAAA
records for the same hostnames (e.g.,@
orwww
).
- Delete any conflicting
-
Set the Custom Domain:
- Go to your repository's Settings > Pages.
- Under "Custom Domain," enter your domain (e.g.,
barrymister.com
ordatacraftworks.com
). - GitHub will validate your DNS settings and display a green checkmark when correctly configured.
-
Enable HTTPS:
- Enable the "Enforce HTTPS" option to ensure all traffic is secure. GitHub will generate a free Let’s Encrypt SSL certificate for your site.
-
Wait for DNS Propagation:
- DNS changes can take a few minutes to several hours to propagate globally.
- Use tools like DNSChecker to verify that your domain points to GitHub’s IPs or
username.github.io
.
-
Visit Your Domain:
- Check your custom domain (e.g.,
https://datacraftworks.com
) to ensure it loads your GitHub Pages content.
- Check your custom domain (e.g.,
-
Add a Favicon:
- Create a
favicon.ico
(or.png
) and upload it to your repository root. - Add the following
<link>
tag in yourindex.html
(or equivalent layout file):<link rel="icon" type="image/x-icon" href="favicon.ico">
- Create a
-
Customize Further:
- Use Jekyll or other tools for more advanced layouts and themes.
- Add a
_config.yml
file to configure your Jekyll theme and other options.
- GitHub Repository:
- Create, enable Pages, add content, set up the domain in settings.
- Domain DNS:
- Add
A
andCNAME
records, verify no conflicts.
- Add
- Validation:
- Wait for DNS propagation, test the site.
- Enhancements:
- Add a favicon and further customize.