By Kashmitha Madushan · Prepared 4 November 2026.
GitHub Pages is a convenient option for static frontend projects. It does not run a .NET server or host a database-backed API, so deploy your ASP.NET Core backend separately if you need one.
1. Prepare your project
Make sure your React application builds successfully. A typical Vite project uses:
npm install
npm run buildReview the generated dist directory. If deploying to a project repository at a subpath, configure Vite's base setting to match that path.
2. Create a repository
Push your source files to a GitHub repository. Never commit passwords or private API keys.
3. Choose your deployment method
In the repository settings, open Pages. GitHub Pages supports publishing from a branch or through GitHub Actions. A React/Vite build commonly uses a GitHub Actions workflow to build and deploy the generated static files.
4. Test routing and assets
Open your published site on mobile and desktop. Check images, CSS, links, and direct navigation to routes. Client-side routes may need a static-host-compatible fallback strategy.
Limitations
Use a separate API host for ASP.NET Core. Never store secrets in frontend environment variables that are bundled into public client-side files.
Read the current official guides: GitHub Pages and Vite static deployment.
Written by Kashmitha Madushan, Associate DevOps Engineer and full-stack developer. Software versions and tools can change; check the linked official documentation before applying steps to a production system.

No comments:
Post a Comment