Reputation: 35
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.
Upvotes: 0
Views: 936
Reputation: 1
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
Now run npm run deploy
Upvotes: 0
Reputation: 1328602
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).
Upvotes: 1