github-actionsgithub-api

Permission denied to github-actions[bot]


I'm using mkdocs to generate documents for my project,now I can't deploy those docs to Github pages,it tell me:

remote: Permission to XXX.git denied to github-actions[bot]. fatal: unable to access 'XXX': The requested URL returned error: 403

This is my CI config.

And my secrets of the repository:(The two GIT_ACTIONS_PUSH are all my personal access tokens.)

And if I start the CI process manually, CI will crash like this.

How can I solve it?


Solution

  • ⚠️ Warning

    This answer recommends changing the default permissions for all action workflows to permissive instead of restrictive. From a security standpoint it is highly discouraged to do so. Instead, check the other answers on this Question for more secure alternatives.

    Check if "Read and write permissions" are enabled in Settings -> Actions -> General -> Workflow permissions:

    Workflow permissions Setting