Github不会让我将个人网站的来源更改为gh-pages分支吗? [英] Github won't let me change the source of my personal website to gh-pages branch?

查看:79
本文介绍了Github不会让我将个人网站的来源更改为gh-pages分支吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

不久前,我使用github页面创建了一个个人网站,但是最近使用ReactJS从头开始重新创建了它.我更改了旧网站存储库的名称,并新建了一个username.github.io,并将CNAME移到了上面.然后,我开始关注:

I made a personal website using github pages a while ago but recently recreated it from scratch using ReactJS. I changed the name of my old website repository and made my new one username.github.io and moved the CNAME over. I then started following:

https://github.com/facebookincubator/create-react-app/blob/master/packages/react-scripts/template/README.md#github-pages

但是,在第4步中,我不得不将源更改为gh-pages分支.更改选项不可单击,其右下方显示必须从master分支构建用户页面".

I'm stuck, however, on step 4 where I'm supposed to change the source to gh-pages branch. The option to change it is not clickable and right below it says "User pages must be built from the master branch".

我的想法是,这是因为我的存储库名为username.github.io,因此是一个用户页面.我猜该教程可能专门针对项目页面?如果这有所作为,我最初也有一个自定义域.我认为问题可能出在我的首页设置不正确吗?由于我的应用程序(存储库)名为username.github.io,因此我对如何设置主页感到有些困惑.我在package.json的首页上尝试使用username.github.io/username.github.io和username.github.io作为主页,但它只是发布了我的自述文件.

My thoughts are that this is because my repository is named username.github.io thus being a user page. I'm guessing the tutorial may be specifically for a project pages? I also originally had a custom domain if that makes a difference. I think maybe the problem might be that my homepage is not set correctly? I was a bit confused on how the homepage should be set up since my app (repository) is named username.github.io. I tried username.github.io/username.github.io and username.github.io for homepage on my package.json but it just publishes my ReadMe.

推荐答案

该教程必须在不考虑用户页面的情况下完成:请参见.

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

如今,发布是直接从用户页面(而非项目页面)的master分支(或master分支的docs文件夹)完成的.

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)

facebookincubator/create-react-app问题2976 :

您可以将源保留在另一个分支中,并在每次构建后将build文件夹的内容复制到master分支.
我认为您不需要做任何特别的事情-只需执行更多手动步骤即可.
也许您可以以某种方式使其自动化.

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.

这篇关于Github不会让我将个人网站的来源更改为gh-pages分支吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆