在 GitHub 个页面上设置 Gatsby

Setting up Gatsby on GitHub Pages

我一直在为自己设置一个 reactjs web app/webpack 等做噩梦。所以现在我正在使用 Gatsby,它救了我的命!!!

我已经使用 NPM 在本地安装了 Gatsby。我想将它部署到我的 Github 页面...它有点工作...

以下是我遵循的说明: https://www.gatsbyjs.org/docs/deploy-gatsby/#github-pages

这是我在 GitHub.io 页面上看到的内容: https://reenaverma.github.io/

它不是默认的入门包索引 page/content,我在我的本地主机 8000 上看到了。

我可以在我的 Github 存储库中看到正确的内容已部署到 Github: https://github.com/ReenaVerma/reenaverma.github.io

但我实际上并没有在 URL 上看到它。看起来它首先出现在我的自述文件中...我该如何解决这个问题?

有什么想法吗?

我看到你的 gatsby 项目是你的 main gh-pages。因此,您需要将构建放在 master 分支 而不是 gh-pages 分支 .

因此您需要将 src 代码放在您选择的分支中,并在 master 分支 中放置您生成的构建。

将您的脚本更改为以下内容

"scripts": {
    "deploy": "gatsby build && gh-pages -b master -d public",
}