0

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.

2 Answers 2

1

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).
Sign up to request clarification or add additional context in comments.

1 Comment

Thank you! I followed a bit of this, and then found the direct link within that menu (it's under "Quickstart for github pages" Link: shorturl.at/clHX0 For anyone else with the same q, 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).
0

To deploy code directly from master

-> Make sure you have changed settings in your package.json

-   "deploy": "gh-pages -d build",
+   "deploy": "gh-pages -b master -d build",

-> Check settings in Github (Repo -> Settings -> Pages)

  • Source in Build and deployment should be Deploy from a Branch

  • Branch should be selected to master

See required settings here

Now run npm run deploy

1 Comment

If you have integrated varcel with the same repo and you have these settings then, it will automatically be deployed on varcel as well.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.