45

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?

Javad
  • 2,033
  • 3
  • 13
  • 23
forestbat
  • 453
  • 4
  • 10

4 Answers4

53

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

Workflow permissions Setting

tdy
  • 36,675
  • 19
  • 86
  • 83
yu xiangxiang
  • 631
  • 4
  • 4
6

If you're creating new files then you need to give explicit write permissions

permissions:
  contents: write
Ewan
  • 87
  • 1
  • 10
  • This is a better solution than the highest voted one because it limits the permissions to the minimum. – psmith Aug 12 '23 at 06:59
0

I think the persist-credentials: false and fetch-depth is the issue. It is deleting the credentials of the git while checking out the repository.

You can try removing the line and try.

    - uses: actions/checkout@v3
-2

You need to update the Actions permissions on the repo as shared here

Mike Mwanje
  • 63
  • 1
  • 13