Home > Software design >  How do I deploy react app on user pages (Github)?
How do I deploy react app on user pages (Github)?

Time:01-03

I am trying to deploy a react app, but specifically on user page on github pages. I can see a LOT of resources for deploying to project page, but nothing yet for user page. Please help!!!

I have tried switching the gh-pages line in the package.json file to include master, but even then I will have to update the gh-pages branch, it doesn't deploy directly from master. I want to be able to deploy directly from master.

CodePudding user response:

gitname/react-gh-pages is one good example, and applies to a user site, where GitHub requires that the repository's name have the following format: {username}.github.io (e.g. gitname.github.io).

But it uses the gh-pages branch as publication source, not master (which no longer exists anyway, since it was renamed to main since Oct. 2020)


The OP cheese-berry references in the comments the post "How do I deploy a simple React app as a "user page" to Github Pages?"

cheese-berry adds:

For anyone else with the same question, you need to basically:

  • pay attention to your repo name,
  • install the gh-pages package,
  • modify your package.json file, and
  • change your source of deployment on GitHub (Repo -> Settings -> Pages -> Build & Deployment).
  • Related