Deploying a Static Site — GitHub Pages, Netlify, Vercel
Publish an HTML and CSS project, verify the live result, and understand static hosting on GitHub Pages, Netlify, and Vercel.
Move a Finished Project From Your Computer to a Public URL
Prerequisites: a working HTML and CSS site, relative paths, Git basics, and responsive testing. This lesson takes a static project from a local folder to a public host, compares GitHub Pages, Netlify, and Vercel at a high level, and gives you a checklist for verifying the deployed result.
A static site is made of files that can be served directly: HTML, CSS, JavaScript, images, fonts, and other assets. A host stores those files and serves them over HTTPS. Static hosting does not run your own server-side application code, so a contact form, account system, or database needs a separate service or backend.
Make the Published Directory Deliberate
For a plain HTML project, decide which folder contains the files the host should publish. A simple project might keep the entry page at the root and static assets in named directories:
study-site/
index.html
about.html
styles/
site.css
images/
classroom.webp
scripts/
menu.jsUse clear file names, check every link, and remove local-only paths such as a file from your Downloads folder. If a browser can load index.html locally but not through a local web server, fix the path before deployment.
<!-- index.html -->
<link rel="stylesheet" href="./styles/site.css">
<img src="./images/classroom.webp" alt="Learners working together">
<a href="./about.html">About the project</a>Relative paths are especially useful for project sites that may live beneath a repository-name path. A path beginning with / is resolved from the domain root and can point somewhere different when the site is hosted below a prefix. Test the final base path for the host you choose.
:root {
color-scheme: light;
font-family: system-ui, sans-serif;
color: #172033;
background: #f8fafc;
}
body {
max-width: 70rem;
margin: 0 auto;
padding: 2rem 1rem;
}
a:focus-visible {
outline: 3px solid #1457c5;
outline-offset: 3px;
}Keep the Deployment Source Reviewable
Put the site in a Git repository, inspect what will be published, and commit a working version. Do not include editor caches, local credentials, or unrelated files. HTML and CSS are public once deployed, so never put passwords, API secrets, private data, or keys in a source file.
git status
git add index.html about.html styles/ images/ scripts/
git diff --cached --stat
git commit -m "Prepare responsive study site for deployment"
git pushCommands depend on your repository setup and branch. The important habit is to review the staged changes before publishing. Open the repository on its hosting provider and confirm the expected files and recent commit are present.
Pick Based on Workflow, Not Brand Hype
All three options can publish static files, but their setup and workflow differ. Settings and product capabilities can change, so use each provider's current documentation for exact steps, limits, and UI labels.
Compare the workflows at a high level
| Host | Common workflow | Watch for |
|---|---|---|
| GitHub Pages | Publish static files from a repository using the project’s Pages settings or supported workflow. | A repository project site can be served below a path prefix; root-relative asset links may need adjustment. |
| Netlify | Connect a repository or upload a static output folder; changes can trigger preview and production deployments. | Set the correct publish directory, and use a form handler or backend if the site needs submissions. |
| Vercel | Connect a repository and deploy its static output; branch changes commonly get preview deployments. | Confirm the project root and build/output settings match a plain static project or its framework. |
For plain files, the build step may simply be absent and the published directory may be the project root. For a toolchain that generates a separate output folder, publish that generated output instead. Do not invent a build command: use the command already defined by the project and verify its output folder locally.
Connect the Repository, Set the Output, Publish
The exact interface varies, but the deployment decision is the same: select the repository, choose its production branch, identify the project root, and specify a build command and publish directory only when the project needs them. Save the settings and wait for the provider to report a successful deployment.
- Connect the intended repository and branch, checking that the provider is authorized to read it.
- Choose the directory that contains the deployable files. For a plain root-level HTML site, this is usually the folder with
index.html. - Use the project's actual build command if one exists; otherwise do not add a build step that the site does not need.
- Wait for the deployment to finish, open the assigned public URL, and verify that the expected version is live.
- Make a tiny, reversible content edit, commit it, and confirm the host deploys the new version from the chosen branch.
GET /index.html
GET /styles/site.css
GET /images/classroom.webp
# Check the browser Network panel for:
# - successful document and asset responses
# - the expected content type for CSS and images
# - no asset request accidentally sent to the wrong pathIf the deployment fails, read its build or publish log and identify the first actionable error. Check whether the provider is building the right folder, whether the entry page exists in the output, and whether a locally required file was excluded from Git.
Test the Public Result, Not Only the Build Status
A green deployment indicator confirms a publish process completed; it does not prove that every URL, image, layout, or interaction works. Test the public site in a fresh browser session and on a narrow viewport. Open nested pages directly, not only by clicking from the home page.
- Check the home page, nested pages, CSS, images, fonts, and navigation links.
- Reload a nested URL and confirm the host serves the intended file instead of an unexpected not-found page.
- Resize the viewport, test keyboard navigation, and verify visible focus and readable contrast.
- Inspect the browser console and Network panel for failed requests or unexpected errors.
- Check the page title, metadata, spelling, and any forms or contact links that appear to promise an action.
- Confirm HTTPS and the intended public URL before sharing it.
Static hosts may cache files, and browsers may retain cached assets too. When a recent change appears missing, first confirm the deployment points to the expected commit, then check the response and cache behavior before making duplicate edits.
Find the Boundary Between Local and Published
Why it fails: The host can deploy successfully while serving a folder that does not contain the built entry page.
Better approach: Build locally if required, inspect the output directory, and configure the host to publish that exact output.
Why it fails: The browser requests the file from the domain root rather than under the repository site prefix.
Better approach: Use paths appropriate to the deployment base path and test the public URL, not only local root hosting.
Why it fails: A host can serve index.html while a nested link, image, or stylesheet still returns a missing-file response.
Better approach: Open direct nested URLs and inspect the Network panel for all critical assets.
Why it fails: Source files are visible to visitors, and static hosting cannot run an arbitrary server-side form or database operation.
Better approach: Remove credentials from the repository and connect any required backend or form service deliberately.
Ship a Small Site and Verify It Like a Visitor
- Prepare a two-page static site with an image, stylesheet, accessible navigation, and a clear page title.
- Commit the files and inspect the staged change list for local-only files or credentials before pushing.
- Deploy to one of the listed hosts, recording the repository, branch, project root, build step, and publish directory you chose.
- Test the live home page, a nested page opened directly, and every asset at both desktop and mobile widths.
- Make one intentional content change, publish it, and confirm the public URL reflects the expected commit.
🎯 Key Takeaways
- ✓A static host serves published files; it does not automatically run a server, database, or form handler.
- ✓Choose the correct project root, build command, and output directory for the files the host should serve.
- ✓Relative paths and a host-specific base path determine whether assets work under a repository prefix.
- ✓Git review keeps deployment source deliberate, and public files must never contain secrets.
- ✓A successful build is not a full QA result: test nested routes, images, CSS, keyboard use, responsive layouts, and browser errors.
- ✓Check current provider documentation for exact configuration because product settings and workflows can change.
What comes next
Now bring the track together in a complete responsive website: plan the structure, implement the layout, and test the finished experience.
Lesson 44 → Building a Complete Responsive WebsiteHELP US IMPROVE
How was this lesson?
Your note is shared with the Chaduvuko team for review. Please don’t include personal or sensitive information.
Spotted a mistake or something unclear? Suggest a fix on GitHub or email us. Select the text first and it is quoted for you.
Discussion
0Have a better approach? Found something outdated? Share it — your knowledge helps everyone learning here.
