Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 282
Reena Verma Avatar asked May 29 '18 20:05

Reena Verma


People also ask

Does GitHub Pages support dynamic pages?

You can't, GHP only serves static content.

Can I host anything on GitHub Pages?

You can use GitHub Pages to host a website about yourself, your organization, or your project directly from a repository on GitHub.com.


1 Answers

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",
}
like image 189
Melchia Avatar answered Oct 19 '22 23:10

Melchia