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.
x failed to create repository: POST https://api.github.com/user/repos: 403 Resource not accessible by personal access tokenCommon 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
- Create a token with repo (and repo admin) scope for the target org or user.
- Export it as the token env var bootstrap reads.
- Re-run
flux bootstrapagainst the same path.
export GITHUB_TOKEN=$FLUX_BOOTSTRAP_TOKEN
flux bootstrap github \
--owner=acme --repository=infra \
--branch=main --path=clusters/prodAllow 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.
flux bootstrap github --owner=acme --repository=infra --branch=flux-init --path=clusters/prodHow 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.