Deploying a static site with Cloudflare Pages via GitHub

Cloudflare Pages gives you free, git-connected hosting for static sites and static-generator output (Hugo, Astro, Next.js static export, plain HTML). Push to main, get a deploy. Push to a branch, get a preview URL. This walkthrough covers the GitHub integration end to end: connecting the repo, build configuration, environment variables, custom domains, and preview deployments. Prerequisites A Cloudflare account (free tier is sufficient) Your site’s source in a GitHub repository A build command and output directory, if you’re using a static site generator (Hugo, Astro, Eleventy, etc.) — skip this if you’re deploying plain HTML/CSS/JS Step 1: connect the GitHub repository Log into the Cloudflare dashboard and select Workers & Pages from the left sidebar. Click Create application → Pages tab → Connect to Git. Authorize Cloudflare’s GitHub App if you haven’t already. You’ll be asked to grant access to either all repositories or a selected list — choose selected repositories and pick only what you need. Don’t grant blanket access to your whole GitHub account for a single site. Select the repository and branch you want to deploy from (usually main). Step 2: configure the build Cloudflare will try to auto-detect your framework. Verify or set: ...

Last updated:  · 5 min · Paul Masterson