I tried using Git Sync announced in Grafana v12

I tried using Git Sync announced in Grafana v12

2025.08.10

Introduction

Grafana v12 was announced in May this year.
https://grafana.com/docs/grafana/latest/whatsnew/whats-new-in-v12-0/

Among its features, Git Sync was released as a preview, allowing you to connect your Grafana instance to a GitHub repository and manage dashboards as code directly from the Grafana UI.
https://grafana.com/docs/grafana/latest/observability-as-code/provision-resources/intro-git-sync/

Although it's still in preview, being able to manage dashboards in GitHub is exciting!
As written in the official documentation, please note that this is an experimental feature and is not recommended for use in production environments.

What's good about it?

I think the biggest benefit is being able to manage dashboards collaboratively with multiple people while maintaining version control through GitHub.

Previously, I wrote an article about manipulating dashboard JSON files via API.
https://dev.classmethod.jp/articles/grafana-cloud-json-cli/

With Git Sync, you no longer need to go through the API.
While using the API doesn't cause major issues when managing dashboards at an individual level, various problems arise when multiple people are involved in management.
The Git Sync feature promises a better development experience for team collaboration.

Setup

We'll follow the setup guide for installation.
The overall process is as follows:

  1. Enable the feature toggle in Grafana
  2. Issue a GitHub personal access token
  3. Configure the GitHub connection

Environment

Grafana
As a prerequisite, Git Sync is currently only supported in OSS or Enterprise versions.
It is not generally available in Grafana Cloud.

For this article, I have installed the Enterprise version of Grafana on my Mac.
The version is 12.1.0-pre.

			
			$ grafana -v
grafana version 12.1.0-pre

		

I also tried with 12.0.x which has Git Sync implemented, but there was a bug that made it unusable in my environment.

GitHub
On the GitHub side, create an appropriate repository to sync your Grafana dashboards. An existing repository is also fine.

Enable feature toggles

To enable Git Sync, you need to enable the provisioning and kubernetesDashboards feature toggles.
To enable feature toggles, add the following settings to your grafana.ini or custom.ini configuration file:

			
			[feature_toggles]
provisioning = true
kubernetesDashboards = true ; use k8s from browser

		

If Grafana is running, restart it after making the above changes.### Issue a GitHub Personal Access Token
Login to GitHub and
select your icon in the top right > Settings > Developer Settings.
CleanShot 2025-08-09 at 23.40.53@2x
Next, open Fine-grained tokens.
CleanShot 2025-08-09 at 23.41.40@2x
Click Generate new token to create a new token.
CleanShot 2025-08-09 at 23.42.50@2x
Select an appropriate token name, expiration date, and target repository.
Set the following permissions necessary for Git Sync in the Permissions section.
Pasted image 20250809235347
Click Generate token and copy the issued token.### Connecting with GitHub
Log in to Grafana, then click on Administration > Provisioning > Configure Git Sync from the left menu.
Pasted image 20250810100421
Enter the GitHub access token and repository URL that you obtained earlier.
Next, enter the default branch and repository path.
As shown in the figure below, if you specify grafana/ as the repository path, a directory called grafana will be automatically created when saving the dashboard JSON.
CleanShot 2025-08-10 at 11.58.34@2x
Next, you will be asked about synchronization targets. In this case, select "Sync all resources with external storage" to ensure that all dashboards are synchronized.
Pasted image 20250810100803
If you select "Sync external storage to a new Grafana folder," a new dashboard folder will be created, and dashboards under that folder will be synchronized with GitHub.

Next, synchronize Grafana and GitHub.
As noted in the caution section, when you click "Begin synchronization" to start syncing, dashboards will be temporarily unavailable, so be careful if multiple people are using them.
Pasted image 20250810101339
If the connection is successful, Job completed successfully will be displayed.
Pasted image 20250810101703
Finally, there are optional settings.
For now, we will complete the setup without configuring anything.
Pasted image 20250810101758
You can set the synchronization interval between Grafana and GitHub, or make Grafana read-only to manage it solely through code.
"Enhance your GitHub experience" allows you to preview which parts of the dashboard will change when making a pull request, showing them as image previews.
This is exciting!
It requires the Grafana Image Renderer plugin, which we won't configure now, but I'd like to try it soon.

Once the connection is complete, the synchronization settings will be added to the Provisioning screen, and if Up-to-date is displayed to the right of the repository name, the setup is complete.
Pasted image 20250810102729## Dashboard Creation
Let's create a dashboard and test if it's linked with GitHub.
Pasted image 20250810110540

Creating a dashboard named "Demo Dashboard".
The data source displays time series test data as a Time series (line graph).
The Comment section corresponds to the Commit message, so I'll enter First Commit.
Since we want to push to the main branch this time, I'll select Push to main in the Workflow section and save it.
CleanShot 2025-08-10 at 10.41.00@2x
Let's check if it's synchronized on the GitHub side.
A new JSON file has been created!!
CleanShot 2025-08-10 at 10.41.37@2x

Changing Code on GitHub Side

Now let's verify that when the JSON file stored in the repository is modified, the changes are automatically reflected in the Grafana dashboard.
I'm changing the JSON content from my local environment to simulate a more typical development workflow.
Pasted image 20250810105947
The change is from displaying test data as a Time series (line graph) to a Bar chart.

			
			-        "type": "timeseries"
+        "type": "barchart"

		

Now let's check the dashboard.
CleanShot 2025-08-10 at 11.07.05@2x
We can confirm that it has changed from Time series to Bar chart.
With this, we've tested the most basic functionality of Git Sync.

Summary

I tried out the Git Sync feature announced in Grafana v12.
Being able to manage dashboard JSONs as code in GitHub seems to be a good fit with dashboard development using Claude Code, which I wrote about previously.
https://dev.classmethod.jp/articles/claude-code-grafana-mcp-sample-dashboard/
Since it's still a preview feature, there were a few functionalities that didn't work well.
I hope it will be officially released as an improved feature, and I plan to submit issues for the features I'd like to see.

Share this article

FacebookHatena blogX

Related articles