如何将 create-react-app 部署到 github 页面?获得 "fatal: Could not read from remote repository."

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

我在尝试将 部署 create-react-app 到 GitHub 页面时遇到错误

在 repo 的设置中启用了 gh-pages,安装了 gh-pages 依赖项,将脚本添加到 package.json

这是回购协议:https://github.com/pablowbk/react-swapi-app

这是我的 package.json 文件的样子:

    {
      "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"
      }
    }

当我 运行 "npm run deploy":

link 截图 -> npm run deploy error (还不能 post imgs,抱歉...)

错误似乎是您的 git 项目的性质造成的。它抱怨你的项目是 shallow repository。请先修复并尝试。详细了解 shallow repository

Github 页面不会执行任何服务器端代码。您只能上传静态文件(html、css、js、图片等)。

为了拥有托管后端,您应该寻找其他服务,例如 Google Cloud、AWS Lambda、Heroku 等