Github won't let me change the source of my personal website to gh-pages branch?

强颜欢笑 提交于 2019-12-05 21:54:00

That tutorial must have been done without taking into account user pages: see August 2016 ("Simpler GitHub Pages publishing").

Nowadays, the publication is done directly from the master branch (or the docs folder of the master branch) for a user page (not a project page)

As mentioned in facebookincubator/create-react-app issue 2976:

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.

VonC's answer is correct. I wanted to, however, clarify and also add on to his answer. The build process for your project will build to a folder (dist/build/etc) that contains an index.html file. Github is looking for this file which in turn looks (most likely) for other files such as style sheets, media, and whatever else you use to build your website.

What VonC is saying is that you can literally just copy and paste necessary files over to the root (what appears upon opening the project folder). Push this and it should work.

However, this is not the ideal solution. You'd have to manually move it over every time you want to build. The way to automate this process is by using symlinks to connect the files in the root to your build folder. This isn't really ideal either but it works!

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!