flux create source git: Track a Repository
flux create source git creates a GitRepository object telling Flux which repo, branch, or tag to pull manifests from.
A source is what a Kustomization or HelmRelease points at. create source git is how you register a repo for Flux to watch.
What it does
flux create source git creates a GitRepository custom resource defining a URL and a checkout target (--branch, --tag, or --tag-semver). For private repos it references a Secret (--secret-ref) or generates one from --username/--password.
Common usage
flux create source git podinfo \
--url=https://github.com/stefanprodan/podinfo \
--branch=master \
--interval=1m
# private repo using an existing secret
flux create source git app \
--url=ssh://git@github.com/acme/app \
--branch=main --secret-ref=app-sshOptions
| Flag | What it does |
|---|---|
| --url <url> | Git repository URL (https:// or ssh://) |
| --branch / --tag / --tag-semver | Checkout target |
| --interval <dur> | How often Flux pulls (e.g. 1m, 5m) |
| --secret-ref <name> | Secret holding credentials for a private repo |
| --username / --password | Generate a credentials Secret inline |
In CI
After creating a source, flux reconcile source git <name> forces an immediate fetch instead of waiting for --interval. Use ssh:// URLs with a deploy key Secret for private repos; an https:// URL needs a token in --secret-ref.
Common errors in CI
"✗ GitRepository source reconciliation failed: ... authentication required" means a private repo with no or wrong --secret-ref. "unable to clone ... reference not found" means the --branch or --tag does not exist. "✗ timed out waiting for condition" means the source-controller could not reach the repo (network/DNS).