我正在使用 github actions 将项目发布到 github 页面,这是 yml 文件:
name: Pages
on:
push:
branches:
- main # default branch
jobs:
pages:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v3
with:
token: ${{ secrets.REPO_TOKEN }}
# If your repository depends on submodule, please see: https://github.com/actions/checkout
submodules: false
- name: Use Node.js 16.x
uses: actions/setup-node@v2
with:
node-version: '16'
- name: Cache NPM dependencies
uses: actions/cache@v2
with:
path: node_modules
key: ${{ runner.OS }}-npm-cache
restore-keys: |
${{ runner.OS }}-npm-cache
- name: Install Dependencies
run: npm install
- name: Build
run: npm run build
- name: Deploy
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.REPO_TOKEN }}
publish_dir: ./public
Run Code Online (Sandbox Code Playgroud)
当步骤遇到 时Deploy,github actions 显示错误:
Action failed with "The process '/usr/bin/git' failed with exit code 128"
Run Code Online (Sandbox Code Playgroud)
我不确定应该使用组织令牌还是使用个人令牌?为什么会发生这个错误?日志详细信息输出如下所示:
Run peaceiris/actions-gh-pages@v3
[INFO] Usage https://github.com/peaceiris/actions-gh-pages#readme
Dump inputs
Setup auth token
Prepare publishing assets
Setup Git config
Create a commit
Push the commit or tag
/usr/bin/git push origin gh-pages
remote: Permission to RedDwarfTech/blog.poemhub.top.git denied to jiangxiaoqiang.
fatal: unable to access 'https://github.com/RedDwarfTech/blog.poemhub.top.git/': The requested URL returned error: 403
Error: Action failed with "The process '/usr/bin/git' failed with exit code 128"
Run Code Online (Sandbox Code Playgroud)
这是组织令牌访问配置:
Von*_*onC 11
peaceiris/actions-gh-pagesGitHub Action的第 742 期提到:
我必须在Settings-Action-General下更改这些设置。
也许值得在文档中调用:
- 工作流程权限:Rean(原文如此)和写入
- 允许 GitHub Actions 批准拉取请求
第497 期建议:
通过重新创建 API 部署密钥来修复。
这导致PR 383确认:
生成的
GITHUB_TOKEN(github_token)不支持推送到外部存储库。
使用deploy_key或personal_token。
| 归档时间: |
|
| 查看次数: |
8761 次 |
| 最近记录: |