You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

GitHub Pages配置失败求助:Actions部署静态HTML遇403错误

解决GitHub Actions部署GitHub Pages时的403错误
  • 检查仓库Pages权限设置
    进入仓库Settings → Pages,确认Source选项设置为"GitHub Actions",同时确保Pages功能已启用(若未启用,先手动开启一次)。

  • 配置GitHub Actions工作流权限
    进入仓库Settings → Actions → General,找到Workflow permissions,选择"Read and write permissions",保存设置。

  • 升级Actions组件版本
    将工作流文件中的actions/configure-pages@v2.1.1替换为最新稳定版(如actions/configure-pages@v5),同时同步更新actions/upload-pages-artifact和actions/deploy-pages到对应最新版本。

  • 确保工作流文件完整
    参考以下完整的部署工作流配置(适用于根目录下的index.html),保存为.github/workflows/deploy.yml:

    name: Deploy to GitHub Pages
    on:
      push:
        branches: ["main"]
      workflow_dispatch:
    permissions:
      contents: read
      pages: write
      id-token: write
    concurrency:
      group: "pages"
      cancel-in-progress: true
    jobs:
      deploy:
        environment:
          name: github-pages
          url: ${{ steps.deployment.outputs.page_url }}
        runs-on: ubuntu-latest
        steps:
          - name: Checkout
            uses: actions/checkout@v4
          - name: Setup Pages
            uses: actions/configure-pages@v5
          - name: Upload artifact
            uses: actions/upload-pages-artifact@v3
            with:
              path: '.'
          - name: Deploy to GitHub Pages
            id: deployment
            uses: actions/deploy-pages@v4
    
  • 排查仓库类型权限
    若为私有仓库,确认账户已开通GitHub Pages私有仓库功能(需对应付费计划);公开仓库则检查是否存在访问限制设置。

内容的提问来源于stack exchange,提问作者Ram Kishore

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.18 01:50:25