Search code examples
reactjsgithubdeploymentgithub-pagescreate-react-app

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...)


Solution

  • 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.