Skip to content

How to deploy on github? #28

Answered by ubaimutl
h3x0r-official asked this question in Q&A
Discussion options

You must be logged in to vote

1. Install the gh-pages using yarn

$ yarn add gh-pages 

2. Add a homepage property to the package.json file

{
    "homepage": "https://{username}.github.io/{repo-name}",
    "name": "react-portfolio",
    "version": "0.1.0",
    "private": true,

3. Add deployment scripts to the package.json file

  "scripts": {
        "start": "react-scripts start",
        "build": "react-scripts build",
    +   "predeploy": "yarn build && cp build/index.html build/404.html",
    +   "deploy": "gh-pages -d build"

4. Add a "remote" that points to the GitHub repository

$ git remote add origin https://github.com/{username}/{repo-name}.git

5. Deploy the React app to GitHub Pages

$ yarn deploy

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by h3x0r-official
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants