A React template that generates a new project with automatic deployment to GitHub Pages.
- Press green button right top corner Use this template and select Create new repository to initialize the repository with template configuration.
- Update vite.config.js the base URL in this file by setting it with the name of your repository, for example base: '/vite-react-template/'
- Inside package.json set the complete website URL as "homepage": "https://{username}.github.io/{repo-name}/"
- Run command
npm i
to install all dependencies - Run
git add .
git commit -m 'add your comment here'
andgit push
to push all your changes to your repository - Navigate to your remote repository on GitHub -> Settings -> Actions -> General. Scroll down to the Workflow permissions and select the Read and Write permissions and Allow GitHub Actions to create and approve pull requests
- Navigate to your remote repository on GitHub -> Settings -> Pages (left sidebar). Select source as “Deploy from branch” and branch as “gh-pages”.
- Now whenever you push your changes to GitHub the page will be automatically updated