I have set up git provisioning, and managed to import all dashboards to my git repo (manually, because the import step was skipped during setup, I’ve already filed a bug report about this). I am using folderless provisioning as all of our dashboards are stored in a single repo. I also have it set up to commit changes back to the repo, which is working fine.
When I create a new dashboard in Grafana, however, it does not commit the new dashboard to the repo and I do not see anywhere in the save dialog to instruct it to do so. Have I encountered a bug, or is this functionality that has just been overlooked somehow?
What Grafana version and what operating system are you using?
13.1.2
What are you trying to achieve?
When a new dashboard is created, commit it to the git repository
How are you trying to achieve it?
Creating a new dashboard from Grafana after setting up git provisioning
What happened?
Dashboard was saved to the database, but not committed to git
What did you expect to happen?
Dashboard configuration would be committed to git
Can you copy/paste the configuration(s) that you are having problems with?
Did you receive any errors in the Grafana UI or in related logs? If so, please tell us exactly what they were.
Did you follow any online instructions? If so, what is the URL?
Yes you’ve hit a current limitation of folderless/instance mode Git Sync (sync.target: instance).
With instance mode Git Sync, a new dashboard created directly in the Grafana UI is saved to Grafana’s database but is not automatically written to the Git repository. There is currently no enforcement option that makes Git the only write path.
This is tracked in Grafana issue #129913, “Git Sync: optional enforcement mode → make the repository the only write path when sync.target: instance”. The proposed enforce: true option is intended to address this behavior.
For now, you can either →
Use folder based Git Sync if you want to create dashboards in Grafana and use the Git Sync save workflow.
Keep folderless/instance mode sync and export/commit the new dashboard JSON to the repository. Git Sync will then provision it.
So the behavior you’re seeing is a known limitation of the current instance mode workflow, not a missing setting in the dashboard Save dialog.
Unfortunately, as noted in my prior thread and bug report, there isn’t a good workflow to migrate dashboards to the repo. Have to export it, commit it, then manually delete the dashboard in order for Grafana to re-import the provisioned version. Not exactly a scalable solution.
You’re right that export → commit → delete → re-import workflow isn’t scalable.
With sync.target: instance, there currently isn’t a direct Grafana UI workflow to create a new dashboard and have it become Git Sync managed and committed to the repository automatically.
If you need the create in Grafana → save/commit to Git workflow, the practical option is to use folder based Git Sync, where the dashboard is created in a Git Sync provisioned folder and Grafana provides the Git Sync save workflow.
If keeping folderless/instance mode is a hard requirement, then unfortunately there isn’t currently an equivalent one step UI workflow for newly created dashboards. The limitation you’re describing is exactly the gap covered by the instance mode Git Sync feature request.