Search code examples
javascriptgithubgithub-pagesgatsby

Setting up Gatsby on GitHub Pages


I've been having a nightmare setting up a reactjs web app/webpack etc myself. So now I'm using Gatsby, which has been a life saver!!!!

I've installed Gatsby locally using NPM. And I want to deploy it to my Github page... It's kinda worked...

Here are the instructions I've followed: https://www.gatsbyjs.org/docs/deploy-gatsby/#github-pages

And here is what I'm seeing on my GitHub.io page: https://reenaverma.github.io/

Its not the default starter pack index page/content, I'm seeing on my localhost 8000.

I can see on my Github repo the correct content has deployed to Github: https://github.com/ReenaVerma/reenaverma.github.io

But I'm not actually seeing it on my URL. It looks like it's surfacing my readme first... How can I fix this?

Any ideas?


Solution

  • I see that your gatsby project is your main gh-pages. Therefore, you need to put your build in the master branch not in the gh-pages branch.

    So you need to put your src code in a branch of your choice & in the master branch you put your generated build.

    Change your script to the following

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