My new Github page isn't showing up

Learn my new github page isn't showing up with practical examples, diagrams, and best practices. Covers git, github, github-pages development techniques with visual explanations.

Troubleshooting GitHub Pages: Why Isn't My Site Showing Up?

Hero image for My new Github page isn't showing up

Learn common reasons why your GitHub Pages site might not be deploying or rendering correctly, and how to fix them. This guide covers repository setup, branch configuration, build errors, and DNS issues.

You've pushed your code to GitHub, configured GitHub Pages, and eagerly navigated to your username.github.io or custom domain, only to be met with a 404 error, a blank page, or an outdated version of your site. This is a common frustration for developers. This article will walk you through the most frequent culprits behind non-appearing GitHub Pages sites and provide clear steps to diagnose and resolve these issues.

1. Repository and Branch Configuration

The foundation of a working GitHub Pages site lies in correct repository and branch setup. GitHub Pages expects specific configurations to know where to find your site's content.

flowchart TD
    A[Start: Push Code to GitHub] --> B{Is Repo Public?}
    B -- No --> C[Make Repo Public]
    B -- Yes --> D{GitHub Pages Enabled?}
    D -- No --> E[Enable GitHub Pages]
    D -- Yes --> F{Correct Branch Selected?}
    F -- No --> G[Select Correct Branch]
    F -- Yes --> H{Source Folder Correct?}
    H -- No --> I[Set Correct Source Folder]
    H -- Yes --> J[Check Build Status]
    C --> J
    E --> J
    G --> J
    I --> J

Initial GitHub Pages Configuration Flow

1. Verify Repository Visibility

For free GitHub Pages, your repository must be public. Go to your repository's Settings > Options > Danger Zone and ensure it's not private. If it is, change it to public. For private repositories, GitHub Pages is a feature of GitHub Pro, Team, or Enterprise accounts.

2. Check GitHub Pages Settings

Navigate to your repository's Settings > Pages. Ensure GitHub Pages is enabled and configured correctly. You should see a message indicating your site is published at a specific URL.

3. Confirm Source Branch

Under Settings > Pages, select the correct branch for your site's source. Typically, this is main or gh-pages. If you're using a static site generator (like Jekyll), you might also need to specify a folder (e.g., /docs or /root).

4. Ensure index.html or README.md Exists

GitHub Pages looks for an index.html file in the root of your chosen source branch/folder. If you're using Jekyll, it will build your site into an _site directory, and the index.html will be there. If neither is present, your site will likely show a 404.

2. Build and Deployment Issues

Even with correct repository settings, your site might fail to build or deploy. This is especially common with static site generators like Jekyll, which GitHub Pages uses by default for many projects.

1. Review GitHub Actions Workflows

Go to the Actions tab in your repository. Look for the 'pages build and deployment' workflow. If it failed, click on the failed workflow run to view the logs. Error messages here are invaluable for pinpointing the problem, such as Jekyll build errors, missing dependencies, or syntax issues.

2. Check Jekyll Configuration (_config.yml)

If you're using Jekyll, ensure your _config.yml file is valid. Common issues include incorrect baseurl, url, or syntax errors. GitHub Pages uses a specific version of Jekyll and its dependencies, so local builds might differ.

3. Clear Browser Cache

Sometimes, your browser might be serving an old cached version of your site. Perform a hard refresh (Ctrl+F5 or Cmd+Shift+R) or clear your browser's cache to ensure you're seeing the latest deployment.

# Example _config.yml for Jekyll
title: My Awesome Site
description: A description of my site.
baseurl: "/my-repo-name" # The subpath of your site, e.g. /blog
url: "https://yourusername.github.io" # The base hostname & protocol for your site

# Exclude files from processing
exclude:
  - Gemfile
  - Gemfile.lock
  - Rakefile
  - README.md
  - .git
  - .gitignore

Example Jekyll _config.yml file. Pay close attention to baseurl and url.

3. Custom Domain and DNS Issues

If you're using a custom domain, misconfigured DNS records are a very common reason for your GitHub Pages site not appearing.

flowchart TD
    A[User Enters Custom Domain] --> B{DNS Resolver}
    B --> C{DNS Records for Domain}
    C -- CNAME Record --> D[Points to username.github.io]
    C -- A Record --> E[Points to GitHub Pages IP]
    D --> F{GitHub Pages Server}
    E --> F
    F -- Valid Configuration --> G[Serve Website]
    F -- Invalid Configuration --> H[404 or Error]
    G --> I[Site Appears]
    H --> J[Troubleshoot DNS/GitHub Settings]

Custom Domain DNS Resolution Flow for GitHub Pages

1. Check CNAME File

In the root of your source branch/folder, ensure you have a file named CNAME (no extension) containing only your custom domain (e.g., www.example.com or example.com). This file tells GitHub Pages which domain to associate with your repository.

2. Verify DNS Records

Log in to your domain registrar's DNS management panel. You need to configure either A records or a CNAME record:

  • For apex domains (e.g., example.com): Set A records pointing to GitHub's IP addresses: 185.199.108.153, 185.199.109.153, 185.199.110.153, 185.199.111.153.
  • For subdomain (e.g., www.example.com): Set a CNAME record pointing to yourusername.github.io (or yourorganization.github.io).

Use a DNS lookup tool (like dig or nslookup) to verify that your DNS records are propagating correctly.

3. Enforce HTTPS

Under Settings > Pages, ensure 'Enforce HTTPS' is checked. If your site is configured for HTTPS but your DNS isn't fully propagated or your CNAME file is missing, this can cause issues. It can take some time for the SSL certificate to provision after setting up a custom domain.

4. Wait for DNS Propagation

DNS changes can take anywhere from a few minutes to 48 hours to propagate across the internet. Be patient and re-check periodically.