问题

使用vuepress+GitHub pages 搭建个人博客,采用GitHub工作流自动部署博客时部署失败

Error: The deploy step encountered an error: 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
  • 在"Fork pull request workflows from outside collaborators"中,选择Require approval for first-time contributors who are new to GitHub
  • 同时"Workflow permissions"中,选择Read and write permissions
  • 点击保存,再次运行工作流即可

在这里插入图片描述

在这里插入图片描述

在这里插入图片描述

Logo

瓜分20万奖金 获得内推名额 丰厚实物奖励 易参与易上手

更多推荐