Skip to content

Instantly share code, notes, and snippets.

@andygock
Last active September 13, 2024 08:12
Show Gist options
  • Save andygock/13cc2ac3d2e2132db13a255f430b1fe2 to your computer and use it in GitHub Desktop.
Save andygock/13cc2ac3d2e2132db13a255f430b1fe2 to your computer and use it in GitHub Desktop.
Deploy dist to GitHub Pages

Deploying to GitHub Pages

Based on guide by Sangsoo Nam

Set up a branch named gh-pages in the repository. This branch will be used to deploy the site.

git checkout --orphan gh-pages
git reset --hard
git commit --allow-empty -m "Initial commit"
git checkout master
rm -rf dist
git worktree add dist gh-pages

Build site

pnpm build

To deploy to GitHub Pages, one can use the following command

cd dist
git add .
git commit -m "Deploy"
git push origin gh-pages

Optionally, remove worktree

git worktree remove dist
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment