# A GitHub or GitLab release needs a token

What "creating the GitHub release … needs GITHUB_TOKEN" means and how to fix it.

```text
error: creating the GitHub release v1.4.0 needs GITHUB_TOKEN
hint: Set GITHUB_TOKEN to a token that can create releases, or take hosting out of [release] in axle.toml.
```

## Why it happens

`hosting` under [`[release]`](https://axlers.dev/docs/reference/configuration.md#releases) asks [`axle release publish`](https://axlers.dev/docs/reference/release.md#github-and-gitlab-releases) to create a GitHub or GitLab release for each tag, and that needs a token: `GITHUB_TOKEN` for GitHub, and `GITLAB_TOKEN` or `CI_JOB_TOKEN` for GitLab. None was set. The packages before it were already published.

## How to fix it

Set the variable in the job that publishes. On GitHub Actions, give the job `permissions: contents: write` and pass `GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}` in its `env`. On GitLab CI, `CI_JOB_TOKEN` is there already. Then run `axle release publish` again; packages already published are skipped. If you don't want hosting releases, take `hosting` out of `[release]`.
