As a side project, I am developing a simple local React app, using Create React App. I periodically push my edits online, to GitHub pages, using npm run deploy
. As expected, the GitHub repo for this project now has two branches:
master
gh-pages
In this GitHub repo, the default branch is gh-pages
.
Does npm run deploy
require that the default branch be gh-pages
? Or can I safely change it to master
( screenshot ), without it affecting npm run deploy
? Specifically, I would like to change the default branch to master
, and still be able to push my local app to GitHub pages. 1
The reason I'd like to change the default branch to master
is because the master
branch is the branch that actually displays the code I wrote, as well as the README file for the GitHub repo. So I'd like to share a link to this repo with collaborators/potential employers, and have my code/README file displayed by default.
Thanks.
1 Whether I continue to do that with npm run deploy
or some other command.
The default publishing source for user and organization sites is the
master
branch. If the repository for your user or organization site has amaster
branch, your site will publish automatically from that branch. You cannot choose a different publishing source for user or organization sites .The default publishing source for a project site is the
gh-pages
branch. If the repository for your project site has agh-pages
branch, your site will publish automatically from that branch.Project sites can also be published from the
master
branch or a/docs
folder on themaster
branch.
(Emphasize is mine — phd )
In case anyone else would like an answer to this question, my GitHub issue finally had a reply, and with some possible answers ( see here ). I unfortunately haven't been able to test the suggestions in that post, as I have since moved my app away from GitHub pages. But the answers in that post seem viable enough to try.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.