如何更改Github Pages的默认index.html位置? [英] How can I change my Github Pages default index.html location?

查看:896
本文介绍了如何更改Github Pages的默认index.html位置?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经尝试了以下线程上显示的内容:

I already tried what's shown on the following threads:

可以我在存储库的子文件夹中有我的Github Pages index.html吗?

可以更改github页面查找索引的位置.html?

基本上,运行git subtree push --prefix public origin gh-pages不会执行任何操作,但我的网站上仍然出现404错误(位于此处.

Basically, running git subtree push --prefix public origin gh-pages doesn't do anything and I still get a 404 error on my site (located here). You can find my site's structure here.

这是我的Github Pages配置:

Here is my Github Pages configuration:

另外,一个可能重要的注意事项是:我的站点是从 master 分支而不是gh-pages分支部署的(在运行上述命令之前甚至不存在)

Also, a possibly important note: my site is being deployed from the master branch, not the gh-pages one (it didn't even exist before running the command above)

有什么想法吗?

推荐答案

如果您要问的是如何将站点代码存储在gh-pages中而不是master中,那么您可以使用不是username.github.io.

If what you are asking is how to store the site code in gh-pages instead of master, then you can do this using a repo name that isn't username.github.io.

使用username.github.io告诉GitHub页面,您的站点代码将在master分支中.

Using username.github.io tells GitHub pages that your site code will be in the master branch.

只需使用普通的存储库名称,即可将代码存储在gh-pages中.

Simply use a normal repository name, and then you will be able to store the code in gh-pages.

这对您来说应该不是问题,因为无论如何您都在使用自定义域,但是您的github.io URL就像http://username.github.io/repo_name.

It shouldn't be an issue for you since you are using a custom domain anyway, but your github.io url would like like http://username.github.io/repo_name.

例如,在普通的非username.github.io存储库中,GitHub设置页面会告诉您:

For example, in a normal non username.github.io repo, the GitHub settings page will tell you:

要更新您的网站,请将HTML或Jekyll更新推送到gh-pages分支.

To update your site, push your HTML or Jekyll updates to your gh-pages branch.

这将使您可以在gh-pages分支之外运行该网站.

This will allow you to run the site off of the gh-pages branch.

这篇关于如何更改Github Pages的默认index.html位置?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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