GitHub 页面显示自述文件而不是 index.html,但仅在提到 html 文件的完整路径时才有效
GitHub page shows readme file instead of index.html but works only if mentioned full path to html file
我是新手,我真的需要一些帮助。我正在尝试从我的 GitHub 存储库部署我的 GitHub 页面。我已将 gh-pages 分支设置为默认分支,我将代码放在那里。
代码在这里:https://github.com/MelisaBogdan/melisabogdan.github.io
我试着用这个 link https://melisabogdan.github.io but all I see is the readme file. BUT I can perfectly see it by mentioning the folders https://melisabogdan.github.io/root/index.html
检查网站是否可见
我知道很多人设法让他们的网站可见而没有提及完整路径(只需键入 https://melisabogdan.github.io)。
有什么我可以做的吗?我真的很感激一些帮助我尝试了其他人的建议....
由于这是一个基于 NodeJS 的站点,因此您需要做很多事情。执行以下步骤以在 https://melisabogdan.github.io/ 查看您的投资组合。基本上,您需要在运行 NodeJS 代码的存储库中设置一个 GitHub 操作,然后将静态 HTML/CSS 文件放入 gh-pages
分支。
- 通过转到 your_repo > 设置 > 分支(在左侧选项卡上)> 默认分支
将默认分支更改为 master
- 在 master 分支中创建一个文件夹
.github
(包括那个点)
- 在此文件夹中创建一个文件夹
workflows
- 在
workflows
文件夹中创建文件 deploy.yml
- 将以下代码放入
deploy.yml
name: Build and Deploy
on:
push:
branches:
- master
jobs:
build-and-deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout ️
uses: actions/checkout@v2.3.1
with:
persist-credentials: false
- name: Install and Build
run: |
npm install
npm run build
- name: Deploy
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./dist
- 所以最后文件夹结构应该是这样的:
melisabogdan.github.io/.github/workflows/deploy.yml
- 现在将这些文件提交给 GitHub
- 现在,如果您转到存储库中的
actions
选项卡,应该会看到一个操作 运行。这将需要 2-3 分钟,然后最后,您应该能够在 https://melisabogdan.github.io/ 看到您的网站
我是新手,我真的需要一些帮助。我正在尝试从我的 GitHub 存储库部署我的 GitHub 页面。我已将 gh-pages 分支设置为默认分支,我将代码放在那里。
代码在这里:https://github.com/MelisaBogdan/melisabogdan.github.io
我试着用这个 link https://melisabogdan.github.io but all I see is the readme file. BUT I can perfectly see it by mentioning the folders https://melisabogdan.github.io/root/index.html
检查网站是否可见我知道很多人设法让他们的网站可见而没有提及完整路径(只需键入 https://melisabogdan.github.io)。 有什么我可以做的吗?我真的很感激一些帮助我尝试了其他人的建议....
由于这是一个基于 NodeJS 的站点,因此您需要做很多事情。执行以下步骤以在 https://melisabogdan.github.io/ 查看您的投资组合。基本上,您需要在运行 NodeJS 代码的存储库中设置一个 GitHub 操作,然后将静态 HTML/CSS 文件放入 gh-pages
分支。
- 通过转到 your_repo > 设置 > 分支(在左侧选项卡上)> 默认分支 将默认分支更改为
- 在 master 分支中创建一个文件夹
.github
(包括那个点)- 在此文件夹中创建一个文件夹
workflows
- 在
workflows
文件夹中创建文件deploy.yml
- 在此文件夹中创建一个文件夹
- 将以下代码放入
deploy.yml
master
name: Build and Deploy
on:
push:
branches:
- master
jobs:
build-and-deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout ️
uses: actions/checkout@v2.3.1
with:
persist-credentials: false
- name: Install and Build
run: |
npm install
npm run build
- name: Deploy
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./dist
- 所以最后文件夹结构应该是这样的:
melisabogdan.github.io/.github/workflows/deploy.yml
- 现在将这些文件提交给 GitHub
- 现在,如果您转到存储库中的
actions
选项卡,应该会看到一个操作 运行。这将需要 2-3 分钟,然后最后,您应该能够在 https://melisabogdan.github.io/ 看到您的网站