# 如何处理 Github Action 报出的 remote: Permission to xx x denied to github-actions[bot]  问题

- Link: https://www.ixiqin.com/2023/02/18/how-to-deal-with-making-the-action-report-remote-permission-denied-to-xx-x-to-making-the-actions-bot-problem/
- Published: 2023-02-18T06:00:00+08:00
- Author: 白宦成

在帮 @MikeyWei 搭建 Beyond-the-World 的网站时，他希望我能够实现 Hexo 自动的部署能力，
这样作为一个写作者，他可以只关注于写作（只需要复制粘贴 Markdown）本身，不需要去处理
Hexo 本身的配置问题。所以我便借助 GitHub Action 来实现自动部署，帮助他实现想要的
目标。

不过，在执行过程中遇到了一个问题，Github 提示 _remote: Permission to xx x denied
to github-actions[bot]_

![](https://files.ixiqin.com/2023/02/23064452/d2b5ca33bd970f64a6301fa75ae2eb22-20-
1024x258.png)

GitHub 提示

但我使用的是 Github 默认的 Secret Token ，并没有手动配置，所以并没有发现有配置权限
的地方。而过去同样方式又是可以的，所以可能的问题便是 Github 提供了新的配置，导致
这个 Token 默认没有权限了。

![](https://files.ixiqin.com/2023/02/23064452/d2b5ca33bd970f64a6301fa75ae2eb22-21-
974x1024.png)

我的配置文件

仔细研究后发现， Github 的确是新增了一个配置，在项目的 Settings – Actions – General
当中，新增了一个选项 workflow permissions。你可以通过直接修改这个选项，来为你的 
Flow 提供默认的读写权限。

![](https://files.ixiqin.com/2023/02/23064452/d2b5ca33bd970f64a6301fa75ae2eb22-22-
1024x391.png)

不过，由于我不是组织的管理员，所以没办法设置，所以我选择了另外一个方式，[在 Action 的 yaml 中添加了 permission 的描述，为这个 Job 新增了写权限](https://github.com/Beyond-the-Word/Beyond-the-Word.github.io/commit/1543f98fabd84b9a0c475f9af97111f00ec80203)，
默认的 Token 便拥有了写权限。

![](https://files.ixiqin.com/2023/02/23064452/d2b5ca33bd970f64a6301fa75ae2eb22-23-
1024x941.png)

## 延展阅读

[https://docs.github.com/en/actions/security-guides/automatic-token-authentication#modifying-the-permissions-for-the-github_token](https://docs.github.com/en/actions/security-guides/automatic-token-authentication#modifying-the-permissions-for-the-github_token)
