简体   繁体   中英

How to deploy create-react-app to github pages? getting "fatal: Could not read from remote repository."

I'm getting an error when trying to deploy a create-react-app to GitHub pages

Enabled gh-pages in repo's settings, installed gh-pages dependencies, added scripts to package.json

This is the repo: https://github.com/pablowbk/react-swapi-app

This is how my package.json file looks:

    {
      "name": "swapiapp",
      "version": "0.1.0",
      "private": true,
      "homepage": "https://pablowbk.github.io/react-swapi-app/",
      "dependencies": {
        "react": "^16.6.3",
        "react-dom": "^16.6.3",
        "react-scripts": "^2.1.3"
      },
      "scripts": {
        "predeploy": "npm run build",
        "deploy": "gh-pages -d build",
        "start": "react-scripts start",
        "build": "react-scripts build",
        "test": "react-scripts test",
        "eject": "react-scripts eject"
      },
      ..., //shortened for posting
      "devDependencies": {
        "gh-pages": "^2.0.1"
      }
    }

and when I run "npm run deploy":

link to screenshot -> npm run deploy error (can't post imgs yet, sorry...)

The error seems to be from the nature of your git project. Its complaining that your project is a shallow repository . Please fix that first & try. Read more about shallow repository .

Github pages will not execute any serverside code. You may only upload static files (html,css,js, images, etc.).

In order to have a hosted backend you should look for another service like Google Cloud, AWS Lambda, Heroku, etc.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM