Host Multiple GitHub Pages with Organizations | Generated by AI

Home PDF

Yes, creating a GitHub organization is a viable way to host additional GitHub Pages sites with unique *.github.io subdomains, as each organization can have its own organization.github.io site, separate from your personal username.github.io site. Here’s how you can do it and what you need to know:

Key Points

Steps to Create a GitHub Organization for Additional *.github.io Subdomains

  1. Create a GitHub Organization:
    • Go to GitHub and sign in with your account.
    • Click the “+” icon in the top-right corner and select New organization.
    • Follow the prompts to set up the organization, choosing a unique name (e.g., myorg). This name will determine the subdomain (e.g., myorg.github.io).
    • Note: Organizations can be created for free, but some features (like private repositories) may require a paid plan, depending on your needs. GitHub Pages for public repositories is available with GitHub Free.
  2. Create the Organization’s GitHub Pages Repository:
    • In the new organization, create a repository named exactly myorg.github.io (replace myorg with your organization’s name).
    • This repository will host the Organization Site, accessible at https://myorg.github.io.
  3. Set Up GitHub Pages:
    • Go to the myorg.github.io repository’s Settings tab.
    • Scroll to the Pages section.
    • Under Source, select the branch you want to publish (e.g., main or gh-pages) and save.
    • Once configured, the site will be live at https://myorg.github.io after a few minutes.
  4. Add Content:
    • Add an index.html file or use a static site generator like Jekyll to the repository’s publishing branch.
    • Commit and push your changes. For example:
      git clone https://github.com/myorg/myorg.github.io
      cd myorg.github.io
      echo "Hello World" > index.html
      git add --all
      git commit -m "Initial commit"
      git push origin main
      
    • Visit https://myorg.github.io to verify the site is live.
  5. Repeat for Additional Subdomains:
    • Create additional organizations (e.g., myorg2, myorg3) and repeat the process to get myorg2.github.io, myorg3.github.io, etc.
    • Each organization can have one *.github.io subdomain, allowing you to create as many subdomains as you have organizations.

Limitations and Considerations

Alternative for Multiple Subdomains

If your goal is to have multiple subdomains (e.g., blog.example.com, shop.example.com) under a single custom domain, you can:

  1. Purchase a custom domain (e.g., example.com) from a registrar like Namecheap or GoDaddy.
  2. Create multiple repositories in your organization (e.g., myorg/blog, myorg/shop).
  3. Enable GitHub Pages for each repository, setting custom domains like blog.example.com and shop.example.com in their respective Pages settings.
  4. Configure CNAME records with your DNS provider to point blog.example.com to myorg.github.io and shop.example.com to myorg.github.io. Note that all repositories without their own custom domain will appear under the organization’s custom domain as subpaths (e.g., example.com/blog).
  5. Be aware that serving multiple subdomains from a single repository is not natively supported by GitHub Pages and may require external services like a CDN or reverse proxy.

Example Scenario

Final Notes

If you have further questions or need help with specific configurations, let me know!


Back 2025.06.29 Donate