Commit 770fdf4b authored by Aaron Lamb's avatar Aaron Lamb Committed by Joe Haddad
Browse files

Update User Guide with deploying to GitHub User pages (#3510)

parent 733ba3ab
Showing with 20 additions and 2 deletions
+20 -2
......@@ -2012,12 +2012,18 @@ For more information see [Add Firebase to your JavaScript Project](https://fireb
**The step below is important!**<br>
**If you skip it, your app will not deploy correctly.**
Open your `package.json` and add a `homepage` field:
Open your `package.json` and add a `homepage` field for your project:
```js
```json
"homepage": "https://myusername.github.io/my-app",
```
or for a GitHub user page:
```json
"homepage": "https://myusername.github.io",
```
Create React App uses the `homepage` field to determine the root URL in the built HTML file.
#### Step 2: Install `gh-pages` and add `deploy` to `scripts` in `package.json`
......@@ -2048,6 +2054,18 @@ Add the following scripts in your `package.json`:
The `predeploy` script will run automatically before `deploy` is run.
If you are deploying to a GitHub user page instead of a project page you'll need to make two
additional modifications:
1. First, change your repository's source branch to be any branch other than **master**.
1. Additionally, tweak your `package.json` scripts to push deployments to **master**:
```diff
"scripts": {
"predeploy": "npm run build",
- "deploy": "gh-pages -d build",
+ "deploy": "gh-pages -b master -d build",
```
#### Step 3: Deploy the site by running `npm run deploy`
Then run:
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment