Follow these steps to deploy your website to GitHub Pages:
First, create a repository with the name yourusername.github.io (replace "yourusername" with your actual GitHub username).
git init
git add .
git commit -m "Initial commit"git remote add origin https://github.com/yourusername/yourusername.github.io.git
git branch -M main
git push -u origin mainAdd these scripts to your package.json:
"scripts": {
"predeploy": "npm run build",
"deploy": "gh-pages -d dist"
}npm install --save-dev gh-pagesnpm run deploy- Go to your repository on GitHub
- Navigate to Settings > Pages
- In the "Source" section, select the
gh-pagesbranch - Save the changes
Your site will be available at https://yourusername.github.io/
If you want to use a custom domain:
- Add a CNAME file to the
publicfolder with your domain name - Configure your domain's DNS settings as directed by GitHub
- In your repository Settings > Pages, add your custom domain name