zl程序教程

您现在的位置是:首页 >  其他

当前栏目

【Git】workflows 部署 vuepress 错误“The process ‘/usr/bin/git‘ failed with exit code 1

2023-02-26 09:50:29 时间

项目场景:

博客系统(vuepress)部署采用自动部署文档的Github工作流。

问题描述

工作流运行过程产生错误"The process ‘/usr/bin/git’ failed with exit code 128 ❌",导致部署失败。

详细工作流运行日志:

Run JamesIves/github-pages-deploy-action@v4

    ╭━━━╮╭╮╭╮╱╭╮╱╱╭╮╱╱╭━━━╮
    ┃╭━╮┣╯╰┫┃╱┃┃╱╱┃┃╱╱┃╭━╮┃
    ┃┃╱╰╋╮╭┫╰━╯┣╮╭┫╰━╮┃╰━╯┣━━┳━━┳━━┳━━╮
    ┃┃╭━╋┫┃┃╭━╮┃┃┃┃╭╮┃┃╭━━┫╭╮┃╭╮┃┃━┫━━┫
    ┃╰┻━┃┃╰┫┃╱┃┃╰╯┃╰╯┃┃┃╱╱┃╭╮┃╰╯┃┃━╋━━┃
    ╰━━━┻┻━┻╯╱╰┻━━┻━━╯╰╯╱╱╰╯╰┻━╮┣━━┻━━╯
    ╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╭━╯┃
    ╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╰━━╯
    ╭━━━╮╱╱╱╱╱╭╮╱╱╱╱╱╱╱╱╭━━━╮╱╱╭╮
    ╰╮╭╮┃╱╱╱╱╱┃┃╱╱╱╱╱╱╱╱┃╭━╮┃╱╭╯╰╮
    ╱┃┃┃┣━━┳━━┫┃╭━━┳╮╱╭╮┃┃╱┃┣━┻╮╭╋┳━━┳━╮
    ╱┃┃┃┃┃━┫╭╮┃┃┃╭╮┃┃╱┃┃┃╰━╯┃╭━┫┃┣┫╭╮┃╭╮╮
    ╭╯╰╯┃┃━┫╰╯┃╰┫╰╯┃╰━╯┃┃╭━╮┃╰━┫╰┫┃╰╯┃┃┃┃
    ╰━━━┻━━┫╭━┻━┻━━┻━╮╭╯╰╯╱╰┻━━┻━┻┻━━┻╯╰╯
    ╱╱╱╱╱╱╱┃┃╱╱╱╱╱╱╭━╯┃
    ╱╱╱╱╱╱╱╰╯╱╱╱╱╱╱╰━━╯
    

    ? Support: https://github.com/sponsors/JamesIves
    ? Maintained by James Ives: https://jamesiv.es

    ? Getting Started Guide: https://github.com/JamesIves/github-pages-deploy-action
    ❓ Discussions / Q&A: https://github.com/JamesIves/github-pages-deploy-action/discussions
    ? Report a Bug: https://github.com/JamesIves/github-pages-deploy-action/issues
Checking configuration and starting deployment… ?
Deploying using Deploy Token… ?
Configuring git…
/usr/bin/git config --global --add safe.directory /home/runner/work/javadirection.github.io/javadirection.github.io
/usr/bin/git config user.name javadirection
/usr/bin/git config user.email 41459401+javadirection@users.noreply.github.com
/usr/bin/git config core.ignorecase false
/usr/bin/git config --local --unset-all http.https://github.com/.extraheader
/usr/bin/git remote rm origin
/usr/bin/git remote add origin ***github.com/javadirection/javadirection.github.io.git
Git configured… ?
Starting to commit changes…
/usr/bin/git ls-remote --heads ***github.com/javadirection/javadirection.github.io.git refs/heads/gh-pages
Creating worktree…
/usr/bin/git worktree add --no-checkout --detach github-pages-deploy-action-temp-deployment-folder
Preparing worktree (detached HEAD c5bddfd)
/usr/bin/git checkout --orphan gh-pages
Switched to a new branch 'gh-pages'
Created the gh-pages branch… ?
/usr/bin/git reset --hard
/usr/bin/git commit --no-verify --allow-empty -m Initial gh-pages commit
[gh-pages (root-commit) d8850af] Initial gh-pages commit
/usr/bin/chmod -R +rw /home/runner/work/javadirection.github.io/javadirection.github.io/docs/.vuepress/dist
/usr/bin/rsync -q -av --checksum --progress /home/runner/work/javadirection.github.io/javadirection.github.io/docs/.vuepress/dist/. github-pages-deploy-action-temp-deployment-folder --delete --exclude CNAME --exclude .nojekyll --exclude .ssh --exclude .git --exclude .github
Checking if there are files to commit…
/usr/bin/git add --all .
/usr/bin/git checkout -b github-pages-deploy-action/srlubmjwh
Switched to a new branch 'github-pages-deploy-action/srlubmjwh'
/usr/bin/git commit -m Deploying to gh-pages from @ javadirection/javadirection.github.io@c5bddfd0c86a68052f02a495637a71ad6b6c2ecc ? --quiet --no-verify
Force-pushing changes...
/usr/bin/git push --force ***github.com/javadirection/javadirection.github.io.git github-pages-deploy-action/srlubmjwh:gh-pages
remote: Permission to javadirection/javadirection.github.io.git denied to github-actions[bot].
fatal: unable to access 'https://github.com/javadirection/javadirection.github.io.git/': The requested URL returned error: 403
Running post deployment cleanup jobs… ?️
/usr/bin/git checkout -B github-pages-deploy-action/srlubmjwh
Reset branch 'github-pages-deploy-action/srlubmjwh'
/usr/bin/chmod -R +rw github-pages-deploy-action-temp-deployment-folder
/usr/bin/git worktree remove github-pages-deploy-action-temp-deployment-folder --force
Error: The deploy step encountered an error: The process '/usr/bin/git' failed with exit code 128 ❌
Notice: Deployment failed! ❌

原因分析:

默认情况下,新存储库没有适当的工作流权限。

解决方案:

转到存储库 Setting

选择 Actions>>>General

在"工作流权限(Workflow permissions)"中,选择 Read and write permissions

在这里插入图片描述
在这里插入图片描述