1. What is Git Sync? #
The principle and what it changes.
The principle #
Available in: ✓ OSS ✓ Enterprise ✓ Cloud Experimental in Grafana 12, generally available from Grafana 13
Git Sync connects Grafana to a Git repository (GitHub): the dashboards and folders of a Grafana folder, or of the whole instance, are stored as JSON files in a branch and path of the repository. Both sides stay in sync: a change saved in Grafana becomes a commit (or a pull request), and a commit pushed to the repository updates Grafana.
It is the built-in « observability as code » building block: teams keep building dashboards visually, while history, review and rollback go through Git.
Git Sync or file provisioning? #
| Criterion | File provisioning | Git Sync |
|---|---|---|
| Direction | Files → Grafana (read-only in the UI) | Grafana ⇄ Git (both ways) |
| Editing a dashboard | Edit the JSON and redeploy | In the UI, then commit or pull request |
| Review | In your CI/CD pipeline | Pull request opened from Grafana |
| Infrastructure | Access to the server file system | A GitHub repository and a token |
| Grafana Cloud | No (no file access) | Yes |
Good to know: classic provisioning (previous lesson) remains the right choice for data sources or locked, non-editable dashboards; Git Sync suits dashboards that teams keep improving.
2. Setup #
Prerequisites, token and repository connection.
Prerequisites #
- Grafana 12 (experimental feature) or Grafana 13 and later; on Grafana Cloud, the feature is offered in the stack.
- Self-managed Grafana 12: enable the
provisioningandkubernetesDashboardsfeature toggles. - A dedicated GitHub repository (or a dedicated folder in a repository) and the administrator role in Grafana.
- For immediate sync, a public Grafana URL reachable by GitHub webhooks; otherwise Grafana polls the repository at a regular interval.
# grafana.ini (self-managed Grafana 12)
[feature_toggles]
provisioning = true
kubernetesDashboards = truedocker run -d --name grafana -p 3000:3000 \
-e GF_FEATURE_TOGGLES_ENABLE=provisioning,kubernetesDashboards \
grafana/grafana:latestThe GitHub token #
Create a fine-grained personal access token scoped to the repository, with these permissions: Contents (read and write), Metadata (read), Pull requests (read and write) and Webhooks (read and write). Give it an expiry date and track it: when it expires, syncing stops.
Common mistake: using a classic token that covers all your repositories. Always scope the token to the synced repository only.
Connect the repository #
- Open Administration › Provisioning (depending on the version: Administration › General › Provisioning) then Configure Git Sync.
- Paste the token, the repository URL, the branch (for example
main) and the files path (defaultgrafana/). - Choose the target: a Grafana folder (recommended to start) or the whole instance.
- Choose whether existing dashboards are exported to the repository during the first sync.
- Set the sync method: webhook (immediate) and/or polling interval, then save.
3. Day-to-day work #
Save, review, roll back.
Saving a dashboard #
A synced dashboard carries the Provisioned label. When saving, Grafana offers to write directly to the configured branch or to create a new branch and open a pull request. With a pull request, the dashboard is only updated in Grafana once the branch is merged.
grafana/
├── web-team/
│ ├── service-overview.json
│ └── api-latency.json
└── infra/
└── kubernetes-nodes.jsonEach repository folder maps to a Grafana folder; each JSON file is a dashboard.
Editing from Git #
A commit on the branch (editing the JSON, renaming, deleting) is applied to Grafana on the next webhook or poll. Deleting a file deletes the dashboard. To roll back, simply revert the commit (git revert).
git pull
# fix a threshold in the JSON
git commit -am "api-latency: alert threshold at 300 ms"
git push
# go back to the previous version
git revert HEAD && git push4. Limits and best practices #
Avoiding bad surprises.
Limits #
- Synced resources are dashboards and folders; alerts, data sources and users belong to other tools (provisioning, Terraform, API).
- GitHub is the supported provider; check GitHub Enterprise and other forges support in your version's documentation.
- In Grafana 12 the feature is experimental: unsupported and subject to change.
- A synced dashboard must not also be managed by file provisioning or by Terraform.
Best practices #
- Start with a pilot folder rather than the whole instance.
- Protect the main branch and require pull requests for critical folders.
- Add a CI check (valid JSON, no duplicate UIDs).
- Use a dedicated service account or token, with scheduled rotation.
- Document in the repository README which Grafana folder maps to which Git folder.
Good practice: keep dashboard UIDs stable: they are the key between Grafana and the repository, and links between dashboards depend on them.
My progress
Sign in to track your progress and take notes. Sign in
💬 Recent discussions about this course
- Grafana : une variable « service » qui dépend de la variable « environnement »✓ solved · 1 reply(ies)
Ask a question about this lesson →See all discussions about this course
Course Glossary
Alerting
The process of notifying teams (via email, Slack, Teams) when a specific event, threshold breach, or anomaly is detected.
HTTP Code 200 (OK)
An HTTP status code indicating that the client's request was successfully processed by the server.
HTTP Code 403 (Forbidden)
An HTTP status code indicating that the server understood the request but refuses to authorize it, usually due to a lack of permissions.
HTTP Code 404 (Not Found)
An HTTP status code indicating that the requested resource could not be found on the server.
Grafana
An open-source interactive data visualization platform that allows users to create, explore, and share analytic dashboards from multiple time-series d...
Recommended Articles
Grafana Assistant: AI at the service of observability
Discover Grafana Assistant, the artificial intelligence integrated into Grafana Cloud. Learn how ...
Monitors, SLOs, dashboards and Datadog as code
Create effective monitors (metrics, logs, APM, composites, anomalies), SLOs, dashboards, and mana...
OpenSearch Dashboards, alerting and observability
Explore data in OpenSearch Dashboards, create alert monitors and discover Trace Analytics, Event ...
Application Observability in Grafana Cloud
Monitor services with OpenTelemetry data: RED, service maps, linked traces and logs.
Frontend Observability in Grafana Cloud
Grafana Cloud RUM: Web Vitals, JavaScript errors and sessions, collected by Faro.
Git for DevOps: branches, code reviews and versions
Organize work with Git in a DevOps approach: trunk-based development or GitFlow, short-lived bran...
Grafana: mastering queries (PromQL, LogQL, SQL and expressions)
Build efficient queries in Grafana: the query editor, Query Inspector, PromQL, LogQL, SQL, the Mi...
Grafana vs Kibana: which visualization tool to choose?
Discover the fundamental differences between Grafana, the king of multi-source metrics, and Kiban...
Grafana Cloud: getting started with the managed platform (Mimir, Loki, Tempo, Alloy)
Discover Grafana Cloud: creating a stack, the free tier, sending metrics, logs and traces with Al...