index.html github 回购未打开

index.html in github repo not opening

我正在尝试查看静态 html 文件。我的 github url 是 anuragasaurus.github.io and my repo name is js-playground,它包含一个 index.html 文件。 我正在尝试打开 anuragasaurus.github.io/js-playground/index.html,但它显示 404。

谁能告诉我如何访问我的 js-playground 存储库中的 index.html 文件。

为了以静态网页的形式查看您的项目文件,您不应将文件存储在默认的 master 分支中,而应存储在 gh-pages 分支中。 您可以使用多种方法创建此分支,但为了找出方便的方法,您可以使用此 GitHub Pages link.

基本上,我们假设您已经有 master 个分支。如果您使用的是 git 命令行工具,您可以通过以下步骤进行操作:

  1. cd your-project-folder
  2. git checkout -b gh-pages(它将创建新分支并切换到它)
  3. git push origin gh-pages(它将在 GitHub 存储库上创建新分支并将现有文件推送到它)