flux bootstrap fails: ssh: handshake failed: unable to authenticate
Routes flux bootstrap SSH failures. Use when bootstrap fails with ssh handshake failed, unable to authenticate, attempted methods [none publickey]. Not for token 403s.
Flux defaults to SSH for the repo connection, but the deploy key never landed on the repo (or the key flux generated is not the one offered) - so the handshake has no key to try. Confirm the deploy key exists on the repo (Settings, Deploy keys), and re-run the identical bootstrap to recreate it. If SSH stays broken (port 22 blocked), switch the source to HTTPS with a secretRef secret instead.
The error
ssh: handshake failed: ssh: unable to authenticate, attempted methods [none publickey], no supported methods remainWhat to do
Check the repo's deploy keys (GitHub: Settings, Deploy keys). Expected: Key present or missing - missing explains everything.
- If missing, re-run the identical bootstrap - it recreates the key:
flux bootstrap github --owner=[org] --repository=[repo] --branch=main --path=[path]Expected: Key created; handshake succeeds.
Alternative: use HTTPS instead of SSH by bootstrapping with token auth, or convert the GitRepository URL to https with a secretRef. Expected: Clone works over HTTPS.
When this applies
- the exact ssh: handshake failed message during bootstrap
- deploy key missing from the repo
- SSH blocked on the network
When it does NOT apply
- 403 on the keys API (token scope - different fix)
- auth failures after bootstrap completed (source secret problem)
Works with
flux CLI 2.x; flux bootstrap github/gitlab
ssh: connect to host github.com port 22: Connection timed out
SSH egress blocked, not an auth problem. Use HTTPS instead.
Why it happens
Bootstrap writes a fresh keypair, posts the public half as a deploy key, and clones over SSH with the private half. If key creation failed silently (see the 403 case), the clone step has no credential and the handshake dies.
Edge cases
- Corporate proxies often block port 22 while 443 works - HTTPS is the durable answer there.
- Verify SSH independently with ssh -T [contact email] before blaming flux.
Resolved from
gh:robdoan/gitops-rackspace (bootstrap notes) - https://github.com/robdoan/gitops-rackspace/blob/HEAD/docs/blog/bootstrapping-homelander-with-flux.md