【问题标题】:GitHub Pages redirects to a different siteGitHub Pages 重定向到不同的站点
【发布时间】:2021-05-03 14:39:23
【问题描述】:

所以我正在尝试使用 GitHub 页面部署我的 Flutter Web 应用程序,但我遇到了一个奇怪的问题。所以我在imgkl.github.io 上有我的投资组合,我正在尝试部署另一个名为fl_catalogue 的应用程序,它的URL 是imgkl.github.io/fl_catalogue/。但是当我尝试使用 fl_catalogue 应用程序时,它会将我带到我的作品集。

我正在使用此工作流程部署站点。

name: Flutter Web
on:
push:
branches:
  - master
jobs:
 build:
   name: Build Web
   env:
     my_secret: ${{secrets.commit_secret}}
   runs-on: ubuntu-latest
   steps:
      - uses: actions/checkout@v1
      - uses: subosito/flutter-action@v1
        with:
           channel: 'beta'
      - run: flutter config --enable-web
      - run: flutter pub get
      - run: flutter build web --release
      - run: |
          cd build/web
          git init
          git config --global user.email my_email
          git config --global user.name Imgkl
          git status
          git remote add origin https://${{secrets.commit_secret}}@github.com/Imgkl/fl_catalogue.git
          git checkout -b gh-pages
          git add --all
          git commit -m "update"
          git push origin gh-pages -f

【问题讨论】:

  • 那么您打算如何进行部署?你的源代码/配置是什么样的?
  • @eis 我已经用我用来部署两个项目的工作流程更新了我的问题。

标签: flutter github github-pages flutter-web


【解决方案1】:

您可能没有更改web/index.html 中的基本路径

  <!--
    If you are serving your web app in a path other than the root, change the
    href value below to reflect the base path you are serving from.

    The path provided below has to start and end with a slash "/" in order for
    it to work correctly.

    Fore more details:
    * https://developer.mozilla.org/en-US/docs/Web/HTML/Element/base
  -->
  <base href="/">

【讨论】:

    猜你喜欢
    • 2018-07-30
    • 2022-11-28
    • 1970-01-01
    • 1970-01-01
    • 2011-07-15
    • 2022-07-24
    • 2016-08-10
    • 2019-09-30
    • 2018-01-03
    相关资源
    最近更新 更多