How to host a website on GitHub: GitHub Pages explained
GitHub Pages is a free static website hosting service built into GitHub. It lets you publish a website directly from a GitHub repository. When you push code to a designated branch or folder, GitHub automatically builds and publishes your site at a yourname.github.io subdomain or a custom domain you configure.
Disclosure: What's Hosting operates a GoDaddy reseller storefront. Competitor guides are editorial research, not products we sell.
GitHub Pages is designed for static websites: HTML, CSS, JavaScript, and static files served directly without server-side processing. It is commonly used for developer portfolios, project documentation, open-source project websites, and personal blogs built with static site generators like Jekyll (which GitHub Pages supports natively), Hugo, or Eleventy.
Setting up GitHub Pages is straightforward for users familiar with GitHub. You create a repository, enable GitHub Pages in the repository settings, choose the source branch, and your site is published. A custom domain can be added by configuring a CNAME file in your repository and updating your domain's DNS records.
GitHub Pages has limitations. It does not support server-side code, databases, or WordPress. Sites must be static. There are bandwidth and file size limits (1GB repository size, 100GB bandwidth per month). For sites that stay within these limits, GitHub Pages is an excellent free hosting option.
Competitors to GitHub Pages for static hosting include Netlify, Vercel, and Cloudflare Pages. All three offer free tiers, fast global CDN delivery, and features like form handling and serverless functions that GitHub Pages lacks. For developer projects and documentation, any of these are strong free options.
Common questions
Is GitHub Pages completely free?
Yes, for public repositories. GitHub Pages for private repositories requires a GitHub Pro, Team, or Enterprise account. The service includes free hosting, SSL, and a github.io subdomain or custom domain.
Can I host WordPress on GitHub Pages?
No. GitHub Pages only supports static files. WordPress requires PHP and a database, which GitHub Pages cannot run. For static sites generated from a headless CMS, you can export static HTML and host it on GitHub Pages.
How is GitHub Pages different from Netlify or Vercel?
All three host static sites for free. Netlify and Vercel offer additional features: serverless functions, form handling, A/B testing, and more sophisticated build pipelines. GitHub Pages is simpler and tighter in its GitHub ecosystem integration.