git GitHub 页面仅显示自述文件?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/48919200/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-19 13:03:59  来源:igfitidea点击:

GitHub pages only showing ReadMe file?

gitgithub

提问by Rookie

I'm trying to host my webpages into Github pages but for some reason it seems to only show my Readme file.

我正在尝试将我的网页托管到 Github 页面中,但由于某种原因,它似乎只显示我的自述文件。

GitHub repo: https://github.com/InquisitiveDev2016/InquisitiveDev2016.github.io

GitHub 存储库:https: //github.com/InquisitiveDev2016/InquisitiveDev2016.github.io

Website:

网站:

https://inquisitivedev2016.github.io/

https://inquisitivedev2016.github.io/

采纳答案by Chris

GitHub Pages is doing what it is designed to do: hosting that entire repository. The root of the repository only contains a single file (README.md). Other pages are there, e.g. https://inquisitivedev2016.github.io/Photo%20Website/webpage.html, but there isn't an easy way to navigate to them.

GitHub Pages 正在做它的设计目标:托管整个存储库。存储库的根目录仅包含一个文件 ( README.md)。其他页面也在那里,例如https://inquisitivedev2016.github.io/Photo%20Website/webpage.html,但没有一种简单的方法可以导航到它们。

Consider moving your web content into the root of your repository and renaming your default page to index.mdor index.html, depending what type of file it is. (By convention the default page of most websites is called index.html, and this is what GitHub Pages will show by default if it exists.)

考虑将您的 Web 内容移动到存储库的根目录中,并将您的默认页面重命名为index.mdindex.html,具体取决于它是什么类型的文件。(按照惯例,大多数网站的默认页面都称为index.html,这是 GitHub Pages 在存在时默认显示的内容。)

回答by bretonio

Create an index.html in the root and insert the line

在根中创建一个 index.html 并插入该行

<meta http-equiv="Refresh" content="2; url=public/index.html">

Or so it worked for me with a Vue CLI project I had this trouble with.

或者它对我有用,我遇到了这个问题的 Vue CLI 项目。

回答by oae

Github gives you multiple choices where it takes it sources from. By default its the root of the master branch, which will use the README.mdin case there is no index.html.

Github 为您提供了多种选择来源。默认情况下,它是 master 分支的根,README.md如果没有index.html.

But you can also switch to the docs/folder in your repository settings. With that you can put the index.htmlunder the docs/folder.

但是您也可以切换到docs/存储库设置中的文件夹。这样,您可以把index.htmldocs/的文件夹。

See enter image description here

在此处输入图片说明