Skip to content
Latchkey

Flux "flux bootstrap failed" token/permissions error in CI

flux bootstrap creates or updates the git repository, commits the Flux manifests, and installs the controllers. It fails when the provided token cannot create the repo, push to it, or register a deploy key.

What this error means

flux bootstrap github fails with a permissions error creating the repository, pushing the commit, or adding the deploy key, and the cluster is left partially bootstrapped.

flux
x failed to create repository: POST https://api.github.com/user/repos: 403 Resource not accessible by personal access token

Common causes

The token lacks repo and admin scope

Bootstrap needs a token that can create the repo and add a deploy key; a token missing repo or admin:repo_hook scope is rejected.

The token cannot push to the target branch

A protected branch or a fine-grained token without contents:write blocks the bootstrap commit.

How to fix it

Use a token with the required scopes

  1. Create a token with repo (and repo admin) scope for the target org or user.
  2. Export it as the token env var bootstrap reads.
  3. Re-run flux bootstrap against the same path.
Terminal
export GITHUB_TOKEN=$FLUX_BOOTSTRAP_TOKEN
flux bootstrap github \
  --owner=acme --repository=infra \
  --branch=main --path=clusters/prod

Allow the push to a protected branch

If the branch is protected, allow the bootstrap principal to push, or bootstrap onto a branch it can write.

Terminal
flux bootstrap github --owner=acme --repository=infra --branch=flux-init --path=clusters/prod

How to prevent it

  • Provision the bootstrap token with repo and deploy-key permissions up front.
  • Store the token as a CI secret, not in the pipeline definition.
  • Bootstrap onto a branch the token is allowed to push to.

Related guides

Run this faster and cheaper on Latchkey managed runners. Start free →