Skip to content

Host Github USER page (not Github project page) with create-react-app #2976

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Closed
BerkeleyPSE opened this issue Aug 19, 2017 · 3 comments
Closed

Comments

@BerkeleyPSE
Copy link

I've built my static website (berkeleypse.github.io) using create-react-app. Now I'm trying to host it as a User page (https://berkeleypse.github.io) rather than a project page (https://berkeleypse.github.io/<no-project-here>).

The User Guide and specifically, these instructions require me to "Ensure my project's settings use gh-pages branch".

But because the static website I'm trying to host is a User page and not a project page, I'm required to have it use the master branch.

So my question is -- how can I make this work? Any help is greatly appreciated. Thank you!

@gaearon
Copy link
Contributor

gaearon commented Aug 19, 2017

You can keep source in another branch, and copy contents of build folder to master branch after every build. I don't think there's anything special you need to do—just more manual steps. Maybe you could automate it somehow.

@gaearon gaearon closed this as completed Aug 19, 2017
@TimoSolo
Copy link

TimoSolo commented Feb 1, 2018

Github pages has the option to use a "docs" folder for the github-pages website. Create-react-app uses a build folder so you just need to rename the build folder to docs. This isn't currently configurable, but you can change your build script in package.json:

"build": "react-scripts build && rm -rf docs && mv build docs"

@guimochila
Copy link

Following the tip from @gaearon , I have created a source branch and the master is only used to track the build folder.
git checkout source
git worktree add build master

@lock lock bot locked and limited conversation to collaborators Jan 18, 2019
# for free to subscribe to this conversation on GitHub. Already have an account? #.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants