This method worked for me: https://dev.to/rashidshamloo/deploying-vite-react-app-to-github-pages-35hf
Dont forget to set the publishing source to the gh-pages branch in Github Settings > Pages > Build and Deployment
gh-pages
Settings > Pages > Build and Deployment