Do I need gh-pages folder in my pero to host react app?

Viewed 105

I know two ways of hosting an app.

  1. You either go to settings and set source branch and select folder.
  2. You can follow some steps like npm --save install gh-pages, npm run deploy and so on. I tried to host my app the 1st way, but it shows README file and it doesn't show index.html in public folder.
1 Answers

The "Configuring a publishing source for your GitHub Pages site" does mention choosing a branch and folder.

But:

  • gh-pages is always a branch, not a folder.
  • the folder referenced in the documentation seems only to be /docs: try for testing your index.html in docs/ rather than public/.

That being said, try and test the new (Dec. 2021) feature:

GitHub Pages: using GitHub Actions for builds and deployments for public repositories

Today you will begin to see a new workflow running called pages build and deployment in your public GitHub Pages repositories.

This workflow is automatically triggered when you push to the branch configured for GitHub Pages in your repository.
As the name suggests, it builds and deploys your pages site.

The initial benefit of this change is enabling you to see your build logs and any errors that may occur which has been a long standing issue for Pages users.

However, in the future this will enable us to give you the ability to fully customize your pages build and deployment workflow to use any static site generator you want without having to push the build output to a special branch of the repository.

You may notice this workflow uses some new actions actions/pages-deploy, and actions/jekyll-build-pages.
For now these actions are designed to be used in the generated workflow, however, starting early next year we will introduce some additional changes that will enable you to take advantage of them.

Learn more about GitHub Pages

Related