docs/sources/as-code/observability-as-code/git-sync/git-sync-setup/_index.md
{{< admonition type="note" >}}
Git Sync functionalities are constantly evolving. Contact Grafana for support or to report any issues you encounter and help us improve this feature.
{{< /admonition >}}
To set up Git Sync and synchronize your Grafana dashboards and folders with a GitHub repository, follow these steps:
Alternatively, on-prem file provisioning in Grafana lets you include resources, including folders and dashboard JSON files, that are stored in a local file system. Refer to Provision resources on-prem for more details.
To set up Git Sync from the Grafana UI, follow these steps:
Git Sync is available for any Git provider through a Pure Git repository type, and has specific enhanced integrations for GitHub, GitHub Enterprise, GitLab and Bitbucket. Refer to Compatible providers for more details.
Select any of these options to proceed:
If you want to configure Git Sync for public cloud GitHub, you can connect using a Personal Access Token or with GitHub App. Whichever you choose, make sure you have the following permissions:
For information on how to set up each method, refer to:
Fill in the following fields:
Select Configure repository to set up your provisioning folder.
If you want to configure Git Sync for GitHub and authenticate with GitHub App:
If you already have an existing GitHub App connected, select Choose an existing app.
If you want to connect using a new GitHub App, select Connect to a new app.
Select Configure repository to set up your provisioning folder.
Similarly, you can connect to GitHub Enterprise Server or GitHub Enterprise Cloud using a Personal Access Token or with GitHub App. Refer to Configure with GitHub for details on the required permissions.
Fill in the following fields:
Select Configure repository to set up your provisioning folder.
If you want to configure Git Sync for GitHub Enterprise and authenticate with GitHub App:
If you already have an existing GitHub App connected, select Choose an existing app.
If you want to connect using a new GitHub App, select Connect to a new app.
https://<enterprise-slug>.ghe.com.Select Configure repository to set up your provisioning folder.
If you want to configure Git Sync for GitLab, you need a GitLab Personal Access Token. To create one, sign in to GitLab and create a token with these permissions:
If you're using a token from a service account, you need to add the service account to the GitLab project as a member to avoid authentication issues.
After creating the token, return to Grafana and fill in the following fields:
Select Configure repository to set up your provisioning folder.
If you want to configure Git Sync for Bitbucket, you need a Bitbucket API token with scopes. To create one, sign in to Bitbucket and create an API token with these permissions:
Return to Grafana and fill in the following fields:
Paste the token into the API Token text box.
Paste the Repository URL for your Bitbucket repository into the text box.
Use the Git clone URL for the repository, not the URL that appears in your browser's address bar when you view the repository. To find it, select Clone in Bitbucket and copy the HTTPS URL. The clone URL ends in .git, and its format depends on your Bitbucket deployment:
https://bitbucket.org/<workspace>/<repository>.githttps://<bitbucket-host>/scm/<PROJECT>/<repository>.git{{< admonition type="tip" >}}
If Grafana returns an ls-refs error when it connects to the repository, check that you entered the clone URL and not the browser URL.
{{< /admonition >}}
Select Configure repository to set up your provisioning folder.
If you're using another Git provider, you need to use the Pure Git option to configure your connection with a Personal Access Token:
Select Configure repository to set up your provisioning folder.
After configuring your connection authentication, continue to enter the details of the repository you want to use for provisioning:
main.Select Choose what to synchronize to have the connection to your repository verified and continue setup.
Next, sync the external resources you specified in the previous step with your Grafana instance. You can store these provisioned resources in Grafana, either at the root of the provisioned folder or in a new folder, without affecting the rest of your instance.
To set up synchronization:
Optionally, you can export any unmanaged resources into the provisioned folder. See how in Synchronize with external storage.
Select Choose additional settings to continue setup.
To proceed with the sync:
Click Choose additional settings for the final configuration steps.
In this last step, you can configure additional options for Git Sync. When you're done, click Finish to complete the setup.
Use the Sync interval (seconds) setting to indicate how often you want your Grafana instance to automatically pull updates from the folder managed with Git Sync. The default value is 300 seconds in Grafana Cloud, and 60 seconds in Grafana OSS/Enterprise.
You can also select these optional settings:
After deciding on these options, you can chose to configure Webhooks or a verified account with the Commit options. Alternatively, if you want your your commits to remain unsigned, click Save to continue.
In the Webhook options menu, you can type in an URL to override the auto-detected URL used to register webhooks. Make sure you have the appropriate permissions to set up and manage webhooks.
You can also check the Disable webhook integration. When checked, Grafana doesn't register or receive webhook events, and polls the repository on an interval instead. Use this when your Grafana instance is not reachable from the public internet.
Git providers limit the amount of webhooks they allow in their repositories. Refer to Webhook limits for more information and to learn how to proceed if you reach these limits.
Starting in Grafana 13.1.0, you can configure a verified account with a signing key, allowing you to enforce your users to sign commits so your Git provider can mark them as Verified. Git Sync supports GPG, SSH, and S/MIME keys.
Starting in Grafana 13.2.0, by default all commits use the signed-in Grafana user as the commit author. For more details, refer to Authoring options.
For the moment, Git Sync doesn't support:
Follow the UI wizard to fill in the required fields to set up any of these options, and refer to the sections below for more details.
In order to implement signed commits, make sure that you set up a specific verification account in your Git provider. You'll need your account's signing key, name and email to set up verification.
For more details on how to create your keys for Git authentication, refer to the official documentation:
To enforce signed commits using an SSH key follow these steps:
After completing the key configuration, any commits your users make to the provisioned folder will appear as Verified.
Starting in Grafana 13.2.0, you can include authoring information to your commits.
If you don't enable commit signing:
author for every commit will be the configured override.If you enable commit signing:
author, and the committer will be the configured signer.Make sure that your synced dashboards are available at the location that you specified:
Now that your resources are synced, you can customize the name, change the branch, and create a pull request (PR) for it. Refer to Manage provisioned repositories with Git Sync for more information.
To update or delete your repository configuration after you've completed setup:
You've successfully set up Git Sync to manage your Grafana dashboards through version control. Your dashboards are now synchronized with a GitHub repository, enabling collaborative development and change tracking.
To learn more about using Git Sync refer to the following documents: