https://github.com/sundevil311/github-pages-example
https://github.com/sundevil311/github-pages-example
Last synced: 4 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/sundevil311/github-pages-example
- Owner: SunDevil311
- Created: 2025-01-11T06:04:52.000Z (12 months ago)
- Default Branch: main
- Last Pushed: 2025-01-11T06:13:06.000Z (12 months ago)
- Last Synced: 2025-08-19T08:51:47.084Z (5 months ago)
- Language: TypeScript
- Size: 435 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Deploying to GitHub Pages
This example supports deploying a statically exported Next.js application to GitHub Pages.
The `out` directory should not be ignored by version control.
## How to use
Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init), [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/), or [pnpm](https://pnpm.io) to bootstrap the example:
```bash
npx create-next-app --example github-pages github-pages-app
```
```bash
yarn create next-app --example github-pages github-pages-app
```
```bash
pnpm create next-app --example github-pages github-pages-app
```
### Deploy to GitHub Pages
1. Create a new public GitHub repository.
1. Edit `next.config.js` to match your GitHub repository name:
- Given the pattern `https://github.com//`, update your `basePath` config to `/repo`.
1. Push the starter code to the `main` branch.
1. Run the `deploy` script (e.g. `npm run deploy`) to create the `gh-pages` branch.
1. On GitHub, go to **Settings** > **Pages** > **Branch**, and choose `gh-pages` as the branch with the `/root` folder. Hit **Save**.
1. Make a change.
1. Run the `deploy` script again to push the changes to GitHub Pages.
Congratulations! You should have a URL like:
```bash
https://.github.io//
```