<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Set up Git Sync on Grafana Labs</title><link>https://grafana.com/docs/grafana/v12.4/as-code/observability-as-code/git-sync/git-sync-setup/</link><description>Recent content in Set up Git Sync on Grafana Labs</description><generator>Hugo -- gohugo.io</generator><language>en</language><atom:link href="/docs/grafana/v12.4/as-code/observability-as-code/git-sync/git-sync-setup/index.xml" rel="self" type="application/rss+xml"/><item><title>Setup prerequisites</title><link>https://grafana.com/docs/grafana/v12.4/as-code/observability-as-code/git-sync/git-sync-setup/set-up-before/</link><pubDate>Fri, 03 Apr 2026 20:44:05 +0000</pubDate><guid>https://grafana.com/docs/grafana/v12.4/as-code/observability-as-code/git-sync/git-sync-setup/set-up-before/</guid><content><![CDATA[&lt;h1 id=&#34;before-you-begin&#34;&gt;Before you begin&lt;/h1&gt;


&lt;div class=&#34;admonition admonition-caution&#34;&gt;&lt;blockquote&gt;&lt;p class=&#34;title text-uppercase&#34;&gt;Caution&lt;/p&gt;&lt;p&gt;Git Sync is available in &lt;a href=&#34;/docs/release-life-cycle/&#34;&gt;public preview&lt;/a&gt; for Grafana Cloud, and is an &lt;a href=&#34;/docs/release-life-cycle/&#34;&gt;experimental feature&lt;/a&gt; in Grafana v12 for open source and Enterprise editions. Documentation and support is available &lt;strong&gt;based on the different tiers&lt;/strong&gt; but might be limited to enablement, configuration, and some troubleshooting. No SLAs are provided.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Git Sync is under development.&lt;/strong&gt; Refer to 
    &lt;a href=&#34;/docs/grafana/v12.4/as-code/observability-as-code/git-sync/usage-limits/&#34;&gt;Usage and performance limitations&lt;/a&gt; for more information. &lt;a href=&#34;/help/&#34;&gt;Contact Grafana&lt;/a&gt; for support or to report any issues you encounter and help us improve this feature.&lt;/p&gt;&lt;/blockquote&gt;&lt;/div&gt;

&lt;p&gt;Before you begin to set up Git Sync, ensure you have the following:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;A Grafana instance (Cloud, OSS, or Enterprise)&lt;/li&gt;
&lt;li&gt;Administration rights in your Grafana organization&lt;/li&gt;
&lt;li&gt;A 
    &lt;a href=&#34;/docs/grafana/v12.4/as-code/observability-as-code/git-sync/usage-limits/#compatible-providers&#34;&gt;Git provider&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;If you&amp;rsquo;re 
    &lt;a href=&#34;/docs/grafana/v12.4/as-code/observability-as-code/git-sync/git-sync-setup/set-up-extend/&#34;&gt;using webhooks or image rendering&lt;/a&gt;, a public instance with external access
&lt;ul&gt;
&lt;li&gt;Optional: The &lt;a href=&#34;https://github.com/grafana/grafana-image-renderer&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;Image Renderer service&lt;/a&gt; to save image previews with your PRs&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Moreover, make sure you&amp;rsquo;re not blocking any of the Grafana services IPs. For a list of IPs you need to add to your allowlist, refer to &lt;a href=&#34;/docs/grafana-cloud/security-and-account-management/allow-list/#hosted-grafana&#34;&gt;Hosted Grafana source IPs&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Finally, get acquainted with the following topics:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
    &lt;a href=&#34;/docs/grafana/v12.4/as-code/observability-as-code/git-sync/#supported-resources&#34;&gt;Git Sync supported resources&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;
    &lt;a href=&#34;/docs/grafana/v12.4/as-code/observability-as-code/git-sync/usage-limits/&#34;&gt;Git Sync usage and performance limitations&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;For further details on how Git Sync operates, refer to 
    &lt;a href=&#34;/docs/grafana/v12.4/as-code/observability-as-code/git-sync/key-concepts/&#34;&gt;key concepts&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;enable-required-feature-toggles&#34;&gt;Enable required feature toggles&lt;/h2&gt;
&lt;p&gt;In Grafana Cloud, Git Sync is being rolled out gradually. For more details refer to &lt;a href=&#34;/docs/rolling-release/&#34;&gt;Rolling release channels for Grafana Cloud&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;To activate Git Sync in Grafana OSS/Enterprise, set the &lt;code&gt;provisioning&lt;/code&gt; feature toggle to &lt;code&gt;true&lt;/code&gt;:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Open your Grafana configuration file, either &lt;code&gt;grafana.ini&lt;/code&gt; or &lt;code&gt;custom.ini&lt;/code&gt;.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Enable the provisioning toggle:&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;ini&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-ini&#34;&gt;[feature_toggles]
provisioning = true&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Save the changes to the file and restart Grafana.&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;For more information about feature toggles, refer to 
    &lt;a href=&#34;/docs/grafana/v12.4/setup-grafana/configure-grafana/feature-toggles/#experimental-feature-toggles&#34;&gt;Configure feature toggles&lt;/a&gt;.&lt;/p&gt;
&lt;h3 id=&#34;enable-git-providers&#34;&gt;Enable Git providers&lt;/h3&gt;
&lt;p&gt;If you&amp;rsquo;re using Grafana Enterprise v12.4.0 and want to set up Git Sync with pure Git, GitLab or Bitbucket, or if you&amp;rsquo;re using Grafana OSS v12.4.0 and want to set up Git Sync with pure Git, add them to your configuration file:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Open your Grafana configuration file, either &lt;code&gt;grafana.ini&lt;/code&gt; or &lt;code&gt;custom.ini&lt;/code&gt;.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Add the available providers:&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;ini&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-ini&#34;&gt;[provisioning]
repository_types = &amp;#34;git|github|bitbucket|gitlab|local&amp;#34;&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Save the changes to the file and restart Grafana.&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;h2 id=&#34;create-a-github-app&#34;&gt;Create a GitHub App&lt;/h2&gt;
&lt;p&gt;GitHub Apps are tools that extend GitHub functionality. They use fine-grained permissions and short-lived tokens, giving you more control over which repositories are being accessed. Find out more in the &lt;a href=&#34;https://docs.github.com/en/apps/overview&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;GitHub Apps official documentation&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;If you chose to authenticate with a newly created GitHub App, you&amp;rsquo;ll need the following parameters:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;GitHub App ID&lt;/li&gt;
&lt;li&gt;GitHub App Private Key&lt;/li&gt;
&lt;li&gt;GitHub App Installation ID&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;There are many ways to create a GitHub App. The following instructions are informative only, always refer to official GitHub documentation for more details.&lt;/p&gt;
&lt;p&gt;To create the GitHub App, follow these steps:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Go to &lt;a href=&#34;https://github.com/settings/apps&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;https://github.com/settings/apps&lt;/a&gt; and click on &lt;strong&gt;New Github App&lt;/strong&gt;, or navigate directly to &lt;a href=&#34;https://github.com/settings/apps/new&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;https://github.com/settings/apps/new&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Fill in the following fields:
&lt;ul&gt;
&lt;li&gt;Name: Must be unique&lt;/li&gt;
&lt;li&gt;Homepage URL: For example, your Grafana Cloud instance URL&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Scroll down to the &lt;strong&gt;Webhook&lt;/strong&gt; section and uncheck the &lt;strong&gt;Active&lt;/strong&gt; box&lt;/li&gt;
&lt;li&gt;In the &lt;strong&gt;Permissions&lt;/strong&gt; section, go to &lt;strong&gt;Repository permissions&lt;/strong&gt; and set these parameters:
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Contents&lt;/strong&gt;: Read and write permission&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Metadata&lt;/strong&gt;: Read-only permission&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Pull requests&lt;/strong&gt;: Read and write permission&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Webhooks&lt;/strong&gt;: Read and write permission&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Finally, under &lt;strong&gt;Where can this GitHub App be installed?&lt;/strong&gt;, select &lt;strong&gt;Only on this account&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Click on &lt;strong&gt;Create Github App&lt;/strong&gt; to complete the process.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;On the app page:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Copy the &lt;strong&gt;AppID&lt;/strong&gt; from the &lt;strong&gt;About&lt;/strong&gt; section&lt;/li&gt;
&lt;li&gt;Select the &lt;strong&gt;Generate private key&lt;/strong&gt; from the banner or scroll down to to the &lt;strong&gt;Private Keys&lt;/strong&gt; section to generate a key&lt;/li&gt;
&lt;li&gt;A PEM file containing your private key will be downloaded to your computer&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Finally, install the app:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;At the top left of the App page, click on &lt;strong&gt;Install App&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Choose for which user you need to install it, you’ll be redirected to the repository selection screen&lt;/li&gt;
&lt;li&gt;Choose for which repositories you want to install the app&lt;/li&gt;
&lt;li&gt;Click &lt;strong&gt;Install&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;On the installation page, copy &lt;strong&gt;&lt;code&gt;installationID&lt;/code&gt;&lt;/strong&gt; from the page URL &lt;a href=&#34;https://github.com/settings/installations/installationID&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;https://github.com/settings/installations/installationID&lt;/a&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;You can now proceed to 
    &lt;a href=&#34;/docs/grafana/v12.4/as-code/observability-as-code/git-sync/git-sync-setup/&#34;&gt;Set up Git Sync&lt;/a&gt;!&lt;/p&gt;
]]></content><description>&lt;h1 id="before-you-begin">Before you begin&lt;/h1>
&lt;div class="admonition admonition-caution">&lt;blockquote>&lt;p class="title text-uppercase">Caution&lt;/p>&lt;p>Git Sync is available in &lt;a href="/docs/release-life-cycle/">public preview&lt;/a> for Grafana Cloud, and is an &lt;a href="/docs/release-life-cycle/">experimental feature&lt;/a> in Grafana v12 for open source and Enterprise editions. Documentation and support is available &lt;strong>based on the different tiers&lt;/strong> but might be limited to enablement, configuration, and some troubleshooting. No SLAs are provided.&lt;/p></description></item><item><title>Set up Git Sync as code</title><link>https://grafana.com/docs/grafana/v12.4/as-code/observability-as-code/git-sync/git-sync-setup/set-up-code/</link><pubDate>Fri, 03 Apr 2026 20:44:05 +0000</pubDate><guid>https://grafana.com/docs/grafana/v12.4/as-code/observability-as-code/git-sync/git-sync-setup/set-up-code/</guid><content><![CDATA[&lt;h1 id=&#34;set-up-git-sync-as-code&#34;&gt;Set up Git Sync as code&lt;/h1&gt;


&lt;div class=&#34;admonition admonition-caution&#34;&gt;&lt;blockquote&gt;&lt;p class=&#34;title text-uppercase&#34;&gt;Caution&lt;/p&gt;&lt;p&gt;Git Sync is available in &lt;a href=&#34;/docs/release-life-cycle/&#34;&gt;public preview&lt;/a&gt; for Grafana Cloud, and is an &lt;a href=&#34;/docs/release-life-cycle/&#34;&gt;experimental feature&lt;/a&gt; in Grafana v12 for open source and Enterprise editions. Documentation and support is available &lt;strong&gt;based on the different tiers&lt;/strong&gt; but might be limited to enablement, configuration, and some troubleshooting. No SLAs are provided.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Git Sync is under development.&lt;/strong&gt; Refer to 
    &lt;a href=&#34;/docs/grafana/v12.4/as-code/observability-as-code/git-sync/usage-limits/&#34;&gt;Usage and performance limitations&lt;/a&gt; for more information. &lt;a href=&#34;/help/&#34;&gt;Contact Grafana&lt;/a&gt; for support or to report any issues you encounter and help us improve this feature.&lt;/p&gt;&lt;/blockquote&gt;&lt;/div&gt;

&lt;p&gt;You can also configure Git Sync using &lt;code&gt;grafanactl&lt;/code&gt;, the Grafana CLI. Since Git Sync configuration is managed as code using Custom Resource Definitions (CRDs), you can create your required resources in YAML files and push them to Grafana using &lt;code&gt;grafanactl&lt;/code&gt;. This approach enables automated, GitOps-style workflows for managing Git Sync configuration instead of using the Grafana UI.&lt;/p&gt;
&lt;p&gt;For more information, refer to the following documents:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
    &lt;a href=&#34;/docs/grafana/v12.4/as-code/observability-as-code/git-sync/key-concepts/#git-sync-repository-resource&#34;&gt;Repository resource&lt;/a&gt; and 
    &lt;a href=&#34;/docs/grafana/v12.4/as-code/observability-as-code/git-sync/key-concepts/#git-sync-repository-resource&#34;&gt;Connection resource&lt;/a&gt; overview&lt;/li&gt;
&lt;li&gt;
    &lt;a href=&#34;/docs/grafana/v12.4/as-code/observability-as-code/git-sync/export-resources/&#34;&gt;Dashboard CRD Format&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;
    &lt;a href=&#34;/docs/grafana/v12.4/as-code/observability-as-code/grafana-cli/&#34;&gt;Grafana CLI documentation&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;set-up-git-sync-as-code-with-the-grafana-cli&#34;&gt;Set up Git Sync as code with the Grafana CLI&lt;/h2&gt;
&lt;p&gt;To set up Git Sync as code with &lt;code&gt;grafanactl&lt;/code&gt;, follow these steps:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Understand requirements, known issues, and limitations 
    &lt;a href=&#34;/docs/grafana/v12.4/as-code/observability-as-code/git-sync/git-sync-setup/#before-you-begin&#34;&gt;before you begin&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;#create-the-repository-crd&#34;&gt;Create the repository CRD&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;#push-the-repository-crd-to-grafana&#34;&gt;Push the repository CRD to Grafana&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;#manage-repository-resources&#34;&gt;Manage repository resources&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;#verify-setup&#34;&gt;Verify setup&lt;/a&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;h2 id=&#34;create-the-resources-crds&#34;&gt;Create the resources CRDs&lt;/h2&gt;
&lt;p&gt;If you&amp;rsquo;re connecting with any of the 
    &lt;a href=&#34;/docs/grafana/v12.4/as-code/observability-as-code/git-sync/usage-limits/#compatible-git-providers&#34;&gt;supported Git providers&lt;/a&gt; using a Personal Access Token, you need to create a repository resource to define the connection between your repositories and your Grafana instance.&lt;/p&gt;
&lt;p&gt;If you&amp;rsquo;re connecting to Git Sync with GitHub App, in addition to the repository resource you need to create a connection resource as well.&lt;/p&gt;
&lt;h3 id=&#34;create-the-connection-resource&#34;&gt;Create the connection resource&lt;/h3&gt;
&lt;p&gt;If you&amp;rsquo;re connecting Git Sync with GitHub App, create a &lt;code&gt;connection.yaml&lt;/code&gt; file defining your Git Sync connection configuration:&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;YAML&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-yaml&#34;&gt;apiVersion: provisioning.grafana.app/v0alpha1
kind: Connection
metadata:
  name: &amp;#39;&amp;lt;GITHUB_CONNECTION_NAME&amp;gt;&amp;#39;
  namespace: default
spec:
  title: &amp;#39;&amp;lt;REPOSITORY_TITLE&amp;gt;&amp;#39;
  type: github
  url: https://github.com
  github:
    appID: &amp;#39;&amp;lt;GITHUB_APP_ID&amp;gt;&amp;#39;
    installationID: &amp;#39;&amp;lt;GITHUB_INSTALL_ID&amp;gt;&amp;#39;
secure:
  privateKey:
    create: &amp;#39;&amp;lt;GITHUB_PRIVATE_KEY&amp;gt;&amp;#39;&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Replace the placeholders with your values:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;em&gt;&lt;code&gt;&amp;lt;GITHUB_CONNECTION_NAME&amp;gt;&lt;/code&gt;&lt;/em&gt;: The name of your GitHub connection&lt;/li&gt;
&lt;li&gt;&lt;em&gt;&lt;code&gt;&amp;lt;REPOSITORY_TITLE&amp;gt;&lt;/code&gt;&lt;/em&gt;: Human-readable name displayed in Grafana UI&lt;/li&gt;
&lt;li&gt;&lt;em&gt;&lt;code&gt;&amp;lt;GITHUB_APP_ID&amp;gt;&lt;/code&gt;&lt;/em&gt;: GitHub App unique identifier&lt;/li&gt;
&lt;li&gt;&lt;em&gt;&lt;code&gt;&amp;lt;GITHUB_INSTALL_ID&amp;gt;&lt;/code&gt;&lt;/em&gt;: GitHub App installation id&lt;/li&gt;
&lt;li&gt;&lt;em&gt;&lt;code&gt;&amp;lt;GITHUB_PRIVATE_KEY&amp;gt;&lt;/code&gt;&lt;/em&gt;: GitHub Private Key&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;create-the-repository-resource&#34;&gt;Create the repository resource&lt;/h3&gt;
&lt;p&gt;Next, create a &lt;code&gt;repository.yaml&lt;/code&gt; file defining your Git Sync configuration. Depending on your Git provider and authentication method, add your Personal Access Token information or the connection name.&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;YAML&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-yaml&#34;&gt;apiVersion: provisioning.grafana.app/v0alpha1
kind: Repository
metadata:
  name: &amp;#39;&amp;lt;REPOSITORY_NAME&amp;gt;&amp;#39;
spec:
  sync:
    enabled: true
    intervalSeconds: 60
    target: folder
  workflows:
    - write
    - branch
  title: &amp;#39;&amp;lt;REPOSITORY_TITLE&amp;gt;&amp;#39;

# Git Sync for GitHub:
spec:
  type: github
  github:
    url: &amp;#39;&amp;lt;GIT_REPO_URL&amp;gt;&amp;#39;
    branch: &amp;#39;&amp;lt;BRANCH&amp;gt;&amp;#39;
    path: grafana/
# GitHub App connection only:
  connection:
    name: &amp;#39;&amp;lt;GITHUB_CONNECTION_NAME&amp;gt;&amp;#39;
# GitHub Personal Access Token only:
secure:
  token: { create: &amp;#34;GIT_PAT&amp;#34; }

# GitLab Personal Access Token only:
spec:
  type: gitlab
  gitlab:
    url: &amp;#39;&amp;lt;GIT_REPO_URL&amp;gt;&amp;#39;
    branch: &amp;#39;&amp;lt;BRANCH&amp;gt;&amp;#39;
secure:
  token: { create: &amp;#34;GIT_PAT&amp;#34; }

# Bitbucket Personal Access Token only:
spec:
  type: bitbucket
  bitbucket:
    url: &amp;#39;&amp;lt;GIT_REPO_URL&amp;gt;&amp;#39;
    branch: &amp;#39;&amp;lt;BRANCH&amp;gt;&amp;#39;
    tokenUser: tokenuser
secure:
  token: { create: &amp;#34;GIT_PAT&amp;#34; }

# Pure Git only:
spec:
  type: git
  git:
    url: &amp;#39;&amp;lt;GIT_REPO_URL&amp;gt;&amp;#39;
    branch: &amp;#39;&amp;lt;BRANCH&amp;gt;&amp;#39;
    path: &amp;#34;grafana/&amp;#34;
    tokenUser: tokenuser
secure:
  token: { create: &amp;#34;GIT_PAT&amp;#34; }&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Replace the placeholders with your values:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;em&gt;&lt;code&gt;&amp;lt;REPOSITORY_NAME&amp;gt;&lt;/code&gt;&lt;/em&gt;: Unique identifier for this repository resource&lt;/li&gt;
&lt;li&gt;&lt;em&gt;&lt;code&gt;&amp;lt;REPOSITORY_TITLE&amp;gt;&lt;/code&gt;&lt;/em&gt;: Human-readable name displayed in Grafana UI&lt;/li&gt;
&lt;li&gt;&lt;em&gt;&lt;code&gt;&amp;lt;GIT_REPO_URL&amp;gt;&lt;/code&gt;&lt;/em&gt;: GitHub repository URL&lt;/li&gt;
&lt;li&gt;&lt;em&gt;&lt;code&gt;&amp;lt;BRANCH&amp;gt;&lt;/code&gt;&lt;/em&gt;: Branch to sync&lt;/li&gt;
&lt;li&gt;&lt;em&gt;&lt;code&gt;&amp;lt;GITHUB_CONNECTION_NAME&amp;gt;&lt;/code&gt;&lt;/em&gt;: The name of your GitHub connection&lt;/li&gt;
&lt;li&gt;&lt;em&gt;&lt;code&gt;&amp;lt;GIT_PAT&amp;gt;&lt;/code&gt;&lt;/em&gt;: Git provider Personal Access Token&lt;/li&gt;
&lt;/ul&gt;


&lt;div class=&#34;admonition admonition-note&#34;&gt;&lt;blockquote&gt;&lt;p class=&#34;title text-uppercase&#34;&gt;Note&lt;/p&gt;&lt;p&gt;Only &lt;code&gt;target: folder&lt;/code&gt; is currently supported for Git Sync.&lt;/p&gt;&lt;/blockquote&gt;&lt;/div&gt;

&lt;h3 id=&#34;configuration-parameters&#34;&gt;Configuration parameters&lt;/h3&gt;
&lt;p&gt;The following configuration parameters are available:&lt;/p&gt;
&lt;section class=&#34;expand-table-wrapper&#34;&gt;&lt;div class=&#34;button-div&#34;&gt;
      &lt;button class=&#34;expand-table-btn&#34;&gt;Expand table&lt;/button&gt;
    &lt;/div&gt;&lt;div class=&#34;responsive-table-wrapper&#34;&gt;
    &lt;table&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th&gt;Field&lt;/th&gt;
              &lt;th&gt;Description&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;metadata.name&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Unique identifier for this repository resource&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;spec.title&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Human-readable name displayed in Grafana UI&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;spec.type&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Repository type (&lt;code&gt;github&lt;/code&gt;)&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;spec.github.url&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;GitHub repository URL&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;spec.github.branch&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Branch to sync&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;spec.github.path&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Directory path containing dashboards&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;spec.github.generateDashboardPreviews&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Generate preview images (true/false)&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;spec.sync.enabled&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Enable synchronization (true/false)&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;spec.sync.intervalSeconds&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Sync interval in seconds&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;spec.sync.target&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Where to place synced dashboards (&lt;code&gt;folder&lt;/code&gt;)&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;spec.workflows&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Enabled workflows: &lt;code&gt;write&lt;/code&gt; (direct commits), &lt;code&gt;branch&lt;/code&gt; (PRs)&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;secure.token.create&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;GitHub Personal Access Token&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/section&gt;&lt;h2 id=&#34;push-the-repository-crd-to-grafana&#34;&gt;Push the repository CRD to Grafana&lt;/h2&gt;
&lt;p&gt;Before pushing any resources, configure &lt;code&gt;grafanactl&lt;/code&gt; with your Grafana instance details. Refer to the &lt;a href=&#34;https://grafana.github.io/grafanactl/&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;grafanactl configuration documentation&lt;/a&gt; for setup instructions.&lt;/p&gt;
&lt;p&gt;Push the repository configuration:&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;sh&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-sh&#34;&gt;grafanactl resources push --path &amp;lt;DIRECTORY&amp;gt;&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;The &lt;code&gt;--path&lt;/code&gt; parameter has to point to the directory containing your &lt;code&gt;repository.yaml&lt;/code&gt; file.&lt;/p&gt;
&lt;p&gt;After pushing, Grafana will:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Create the repository resource&lt;/li&gt;
&lt;li&gt;Connect to your GitHub repository&lt;/li&gt;
&lt;li&gt;Pull dashboards from the specified path&lt;/li&gt;
&lt;li&gt;Begin syncing at the configured interval&lt;/li&gt;
&lt;/ol&gt;
&lt;h2 id=&#34;manage-repository-resources&#34;&gt;Manage repository resources&lt;/h2&gt;
&lt;h3 id=&#34;list-repositories&#34;&gt;List repositories&lt;/h3&gt;
&lt;p&gt;To list all repositories:&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;sh&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-sh&#34;&gt;grafanactl resources get repositories&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;h3 id=&#34;get-repository-details&#34;&gt;Get repository details&lt;/h3&gt;
&lt;p&gt;To get details for a specific repository:&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;sh&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-sh&#34;&gt;grafanactl resources get repository/&amp;lt;REPOSITORY_NAME&amp;gt;
grafanactl resources get repository/&amp;lt;REPOSITORY_NAME&amp;gt; -o json
grafanactl resources get repository/&amp;lt;REPOSITORY_NAME&amp;gt; -o yaml&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;h3 id=&#34;update-the-repository&#34;&gt;Update the repository&lt;/h3&gt;
&lt;p&gt;To update a repository:&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;sh&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-sh&#34;&gt;grafanactl resources edit repository/&amp;lt;REPOSITORY_NAME&amp;gt;&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;h3 id=&#34;delete-the-repository&#34;&gt;Delete the repository&lt;/h3&gt;
&lt;p&gt;To delete a repository:&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;sh&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-sh&#34;&gt;grafanactl resources delete repository/&amp;lt;REPOSITORY_NAME&amp;gt;&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;h2 id=&#34;verify-setup&#34;&gt;Verify setup&lt;/h2&gt;
&lt;p&gt;Check that Git Sync is working:&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;sh&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-sh&#34;&gt;# List repositories
grafanactl resources get repositories

# Check Grafana UI
# Navigate to: Administration → Provisioning → Git Sync&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
]]></content><description>&lt;h1 id="set-up-git-sync-as-code">Set up Git Sync as code&lt;/h1>
&lt;div class="admonition admonition-caution">&lt;blockquote>&lt;p class="title text-uppercase">Caution&lt;/p>&lt;p>Git Sync is available in &lt;a href="/docs/release-life-cycle/">public preview&lt;/a> for Grafana Cloud, and is an &lt;a href="/docs/release-life-cycle/">experimental feature&lt;/a> in Grafana v12 for open source and Enterprise editions. Documentation and support is available &lt;strong>based on the different tiers&lt;/strong> but might be limited to enablement, configuration, and some troubleshooting. No SLAs are provided.&lt;/p></description></item><item><title>Set up Git Sync with Terraform</title><link>https://grafana.com/docs/grafana/v12.4/as-code/observability-as-code/git-sync/git-sync-setup/set-up-terraform/</link><pubDate>Fri, 03 Apr 2026 20:44:05 +0000</pubDate><guid>https://grafana.com/docs/grafana/v12.4/as-code/observability-as-code/git-sync/git-sync-setup/set-up-terraform/</guid><content><![CDATA[&lt;h1 id=&#34;set-up-git-sync-with-terraform&#34;&gt;Set up Git Sync with Terraform&lt;/h1&gt;


&lt;div class=&#34;admonition admonition-caution&#34;&gt;&lt;blockquote&gt;&lt;p class=&#34;title text-uppercase&#34;&gt;Caution&lt;/p&gt;&lt;p&gt;Git Sync is available in &lt;a href=&#34;/docs/release-life-cycle/&#34;&gt;public preview&lt;/a&gt; for Grafana Cloud, and is an &lt;a href=&#34;/docs/release-life-cycle/&#34;&gt;experimental feature&lt;/a&gt; in Grafana v12 for open source and Enterprise editions. Documentation and support is available &lt;strong&gt;based on the different tiers&lt;/strong&gt; but might be limited to enablement, configuration, and some troubleshooting. No SLAs are provided.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Git Sync is under development.&lt;/strong&gt; Refer to 
    &lt;a href=&#34;/docs/grafana/v12.4/as-code/observability-as-code/git-sync/usage-limits/&#34;&gt;Usage and performance limitations&lt;/a&gt; for more information. &lt;a href=&#34;/help/&#34;&gt;Contact Grafana&lt;/a&gt; for support or to report any issues you encounter and help us improve this feature.&lt;/p&gt;&lt;/blockquote&gt;&lt;/div&gt;

&lt;p&gt;You can also configure Git Sync via the Grafana provisioning app platform using Terraform.&lt;/p&gt;
&lt;h2 id=&#34;before-you-begin&#34;&gt;Before you begin&lt;/h2&gt;
&lt;p&gt;Before you begin, make sure to have the following:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;A Grafana Cloud account or an on-prem Grafana instance.&lt;/li&gt;
&lt;li&gt;Administrator permissions in your Grafana stack/instance.&lt;/li&gt;
&lt;li&gt;Terraform 1.11 or later installed on your machine. Refer to the &lt;a href=&#34;https://developer.hashicorp.com/terraform/install&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;Terraform install documentation&lt;/a&gt; to learn more.&lt;/li&gt;
&lt;/ul&gt;


&lt;div class=&#34;admonition admonition-note&#34;&gt;&lt;blockquote&gt;&lt;p class=&#34;title text-uppercase&#34;&gt;Note&lt;/p&gt;&lt;p&gt;Save all of the following Terraform configuration files in the same directory.&lt;/p&gt;&lt;/blockquote&gt;&lt;/div&gt;

&lt;h2 id=&#34;configure-the-grafana-provider&#34;&gt;Configure the Grafana provider&lt;/h2&gt;
&lt;p&gt;Use this Terraform configuration to set up the &lt;a href=&#34;https://registry.terraform.io/providers/grafana/grafana/latest/docs&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;Grafana provider&lt;/a&gt; to provide the authentication required to configure Git Sync.&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Create a service account and token in Grafana. For more information refer to &lt;a href=&#34;/docs/grafana/latest/administration/service-accounts/#service-account-tokens&#34;&gt;Service account tokens&lt;/a&gt; or &lt;a href=&#34;/docs/grafana-cloud/as-code/infrastructure-as-code/terraform/terraform-cloud-stack/&#34;&gt;Creating and managing a Grafana Cloud stack using Terraform&lt;/a&gt;.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Make sure that the token has the Admin or the &lt;code&gt;Provisioning:Repositories&lt;/code&gt; writer permission.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Create a file named &lt;code&gt;main.tf&lt;/code&gt; and add the following:&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;terraform&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-terraform&#34;&gt;   terraform {
     required_providers {
       grafana = {
         source  = &amp;#34;grafana/grafana&amp;#34;
         version = &amp;#34;&amp;gt;= 4.28.1&amp;#34;
       }
     }
   }

   provider &amp;#34;grafana&amp;#34; {
     cloud_api_url = &amp;#34;&amp;lt;STACK_URL&amp;gt;&amp;#34;
     stack_id = &amp;#34;&amp;lt;STACK_ID&amp;gt;&amp;#34;
     cloud_access_policy_token = &amp;#34;&amp;lt;SERVICE_ACCOUNT_TOKEN&amp;gt;&amp;#34;
   }&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Replace the following field values:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;STACK_URL&lt;/code&gt; with the URL of your Grafana stack, for example &lt;code&gt;https://my-stack.grafana.net/&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;&amp;lt;STACK_ID&amp;gt;&lt;/code&gt; with the Grafana stack ID, if you are using a Grafana Cloud stack&lt;/li&gt;
&lt;li&gt;&lt;code&gt;SERVICE_ACCOUNT_TOKEN&lt;/code&gt; with the service account token that you created&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;create-the-resources-to-use-git-sync&#34;&gt;Create the resources to use Git Sync&lt;/h2&gt;
&lt;p&gt;You need two resources for configure and manage Git Sync:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;The repository resource configures the Git repository to sync Grafana resources with. For examples, refer to &lt;a href=&#34;https://registry.terraform.io/providers/grafana/grafana/latest/docs/resources/apps_provisioning_repository_v0alpha1&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;Repository resource&lt;/a&gt; in the Terraform registry.&lt;/li&gt;
&lt;li&gt;The connection resource configures your Git provider credentials. For examples, refer to &lt;a href=&#34;https://registry.terraform.io/providers/grafana/grafana/latest/docs/resources/apps_provisioning_connection_v0alpha1&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;Connection resource&lt;/a&gt; in the Terraform registry.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;For better understanding of the required resources, refer to 
    &lt;a href=&#34;/docs/grafana/v12.4/as-code/observability-as-code/git-sync/key-concepts/&#34;&gt;Git Sync key concepts&lt;/a&gt;.&lt;/p&gt;
]]></content><description>&lt;h1 id="set-up-git-sync-with-terraform">Set up Git Sync with Terraform&lt;/h1>
&lt;div class="admonition admonition-caution">&lt;blockquote>&lt;p class="title text-uppercase">Caution&lt;/p>&lt;p>Git Sync is available in &lt;a href="/docs/release-life-cycle/">public preview&lt;/a> for Grafana Cloud, and is an &lt;a href="/docs/release-life-cycle/">experimental feature&lt;/a> in Grafana v12 for open source and Enterprise editions. Documentation and support is available &lt;strong>based on the different tiers&lt;/strong> but might be limited to enablement, configuration, and some troubleshooting. No SLAs are provided.&lt;/p></description></item><item><title>Instantaneous pulling and dashboard previews</title><link>https://grafana.com/docs/grafana/v12.4/as-code/observability-as-code/git-sync/git-sync-setup/set-up-extend/</link><pubDate>Fri, 03 Apr 2026 20:44:05 +0000</pubDate><guid>https://grafana.com/docs/grafana/v12.4/as-code/observability-as-code/git-sync/git-sync-setup/set-up-extend/</guid><content><![CDATA[&lt;h1 id=&#34;set-up-instantaneous-pulling-and-dashboard-previews-in-pull-requests&#34;&gt;Set up instantaneous pulling and dashboard previews in Pull Requests&lt;/h1&gt;


&lt;div class=&#34;admonition admonition-caution&#34;&gt;&lt;blockquote&gt;&lt;p class=&#34;title text-uppercase&#34;&gt;Caution&lt;/p&gt;&lt;p&gt;Git Sync is available in &lt;a href=&#34;/docs/release-life-cycle/&#34;&gt;public preview&lt;/a&gt; for Grafana Cloud, and is an &lt;a href=&#34;/docs/release-life-cycle/&#34;&gt;experimental feature&lt;/a&gt; in Grafana v12 for open source and Enterprise editions. Documentation and support is available &lt;strong&gt;based on the different tiers&lt;/strong&gt; but might be limited to enablement, configuration, and some troubleshooting. No SLAs are provided.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Git Sync is under development.&lt;/strong&gt; Refer to 
    &lt;a href=&#34;/docs/grafana/v12.4/as-code/observability-as-code/git-sync/usage-limits/&#34;&gt;Usage and performance limitations&lt;/a&gt; for more information. &lt;a href=&#34;/help/&#34;&gt;Contact Grafana&lt;/a&gt; for support or to report any issues you encounter and help us improve this feature.&lt;/p&gt;&lt;/blockquote&gt;&lt;/div&gt;

&lt;p&gt;After 
    &lt;a href=&#34;/docs/grafana/v12.4/as-code/observability-as-code/git-sync/git-sync-setup/&#34;&gt;setup&lt;/a&gt;, you can optionally extend Git Sync by enabling pull request notifications and image previews of dashboard changes.&lt;/p&gt;
&lt;section class=&#34;expand-table-wrapper&#34;&gt;&lt;div class=&#34;button-div&#34;&gt;
      &lt;button class=&#34;expand-table-btn&#34;&gt;Expand table&lt;/button&gt;
    &lt;/div&gt;&lt;div class=&#34;responsive-table-wrapper&#34;&gt;
    &lt;table&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th&gt;Capability&lt;/th&gt;
              &lt;th&gt;Benefit&lt;/th&gt;
              &lt;th&gt;Requires&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td&gt;A table summarizing changes to your pull request&lt;/td&gt;
              &lt;td&gt;A convenient way to save changes back to GitHub&lt;/td&gt;
              &lt;td&gt;Webhooks configured&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;A dashboard preview image to a PR&lt;/td&gt;
              &lt;td&gt;A snapshot of dashboard changes to a pull request outside Grafana&lt;/td&gt;
              &lt;td&gt;Image renderer and webhooks configured&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/section&gt;&lt;h2 id=&#34;set-up-webhooks-for-real-time-notification-and-pull-request-integration&#34;&gt;Set up webhooks for real-time notification and pull request integration&lt;/h2&gt;
&lt;p&gt;Real-time notifications (or automatic pulling) is enabled and configured by default in Grafana Cloud.&lt;/p&gt;
&lt;p&gt;In Grafana OSS/Enterprise, Git Sync uses webhooks to enable real-time updates from GitHub public repositories, or to enable pull request integrations. Without webhooks the polling interval is set during configuration, and is 60 seconds by default. You can set up webhooks with whichever service or tooling you prefer: Cloudflare Tunnels with a Cloudflare-managed domain, port-forwarding and DNS options, or a tool such as &lt;code&gt;ngrok&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;To set up webhooks:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Expose your Grafana instance to the public Internet.&lt;/li&gt;
&lt;/ol&gt;
&lt;ul&gt;
&lt;li&gt;Use port forwarding and DNS, a tool such as &lt;code&gt;ngrok&lt;/code&gt;, or any other method you prefer.&lt;/li&gt;
&lt;li&gt;The permissions set in your GitHub access token provide the authorization for this communication.&lt;/li&gt;
&lt;/ul&gt;
&lt;ol&gt;
&lt;li&gt;After you have the public URL, add it to your Grafana configuration file:&lt;/li&gt;
&lt;/ol&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;ini&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-ini&#34;&gt;[server]
root_url = https://&amp;lt;PUBLIC_DOMAIN&amp;gt;&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;ol&gt;
&lt;li&gt;Replace &lt;em&gt;&lt;code&gt;&amp;lt;PUBLIC_DOMAIN&amp;gt;&lt;/code&gt;&lt;/em&gt; with your public domain.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;To check the configured webhooks, go to &lt;strong&gt;Administration &amp;gt; General &amp;gt; Provisioning&lt;/strong&gt; and click the &lt;strong&gt;View&lt;/strong&gt; link for your GitHub repository.&lt;/p&gt;
&lt;h3 id=&#34;expose-necessary-paths-only&#34;&gt;Expose necessary paths only&lt;/h3&gt;
&lt;p&gt;If your security setup doesn&amp;rsquo;t permit publicly exposing the Grafana instance, you can either choose to allowlist the GitHub IP addresses, or expose only the necessary paths.&lt;/p&gt;
&lt;p&gt;The necessary paths required to be exposed are, in RegExp:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;/apis/provisioning\.grafana\.app/v0(alpha1)?/namespaces/[^/]&#43;/repositories/[^/]&#43;/(webhook|render/.*)$&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;set-up-image-rendering-for-dashboard-previews&#34;&gt;Set up image rendering for dashboard previews&lt;/h2&gt;


&lt;div class=&#34;admonition admonition-caution&#34;&gt;&lt;blockquote&gt;&lt;p class=&#34;title text-uppercase&#34;&gt;Caution&lt;/p&gt;&lt;p&gt;Only available in Grafana OSS and Grafana Enterprise.&lt;/p&gt;&lt;/blockquote&gt;&lt;/div&gt;

&lt;p&gt;Set up image rendering to add visual previews of dashboard updates directly in pull requests. Image rendering also requires webhooks.&lt;/p&gt;
&lt;p&gt;To enable this capability, install the Grafana Image Renderer in your Grafana instance. For more information and installation instructions, refer to the &lt;a href=&#34;https://github.com/grafana/grafana-image-renderer&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;Image Renderer service&lt;/a&gt;.&lt;/p&gt;
&lt;h2 id=&#34;next-steps&#34;&gt;Next steps&lt;/h2&gt;
&lt;p&gt;To learn more about using Git Sync refer to the following documents:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
    &lt;a href=&#34;/docs/grafana/v12.4/as-code/observability-as-code/git-sync/git-sync-setup/&#34;&gt;Set up Git Sync&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;
    &lt;a href=&#34;/docs/grafana/v12.4/as-code/observability-as-code/git-sync/export-resources/&#34;&gt;Export resources&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;
    &lt;a href=&#34;/docs/grafana/v12.4/as-code/observability-as-code/git-sync/use-git-sync/&#34;&gt;Work with provisioned repositories&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;
    &lt;a href=&#34;/docs/grafana/v12.4/as-code/observability-as-code/git-sync/provisioned-dashboards/&#34;&gt;Work with provisioned dashboards&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;
    &lt;a href=&#34;/docs/grafana/v12.4/as-code/observability-as-code/git-sync/git-sync-deployment-scenarios/&#34;&gt;Git Sync deployment scenarios&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
]]></content><description>&lt;h1 id="set-up-instantaneous-pulling-and-dashboard-previews-in-pull-requests">Set up instantaneous pulling and dashboard previews in Pull Requests&lt;/h1>
&lt;div class="admonition admonition-caution">&lt;blockquote>&lt;p class="title text-uppercase">Caution&lt;/p>&lt;p>Git Sync is available in &lt;a href="/docs/release-life-cycle/">public preview&lt;/a> for Grafana Cloud, and is an &lt;a href="/docs/release-life-cycle/">experimental feature&lt;/a> in Grafana v12 for open source and Enterprise editions. Documentation and support is available &lt;strong>based on the different tiers&lt;/strong> but might be limited to enablement, configuration, and some troubleshooting. No SLAs are provided.&lt;/p></description></item></channel></rss>