<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/v13.3/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/v13.3/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/v13.3/as-code/git-sync/git-sync-setup/set-up-before/</link><pubDate>Wed, 28 Oct 2026 09:22:36 +0000</pubDate><guid>https://grafana.com/docs/grafana/v13.3/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;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/v13.3/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/v13.3/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;/li&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;h2 id=&#34;enable-required-feature-toggles&#34;&gt;Enable required feature toggles&lt;/h2&gt;
&lt;p&gt;The &lt;code&gt;provisioning&lt;/code&gt; feature toggle is enabled by default in Grafana Cloud and, starting in Grafana v13, for OSS and Enterprise as well. No manual configuration is required.&lt;/p&gt;
&lt;p&gt;For more information about feature toggles, refer to 
    &lt;a href=&#34;/docs/grafana/v13.3/setup-grafana/configure-grafana/feature-toggles/&#34;&gt;Configure feature toggles&lt;/a&gt;.&lt;/p&gt;
&lt;h2 id=&#34;enable-git-providers&#34;&gt;Enable Git providers&lt;/h2&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;enable-oauth-connection-types&#34;&gt;Enable OAuth connection types&lt;/h2&gt;
&lt;p&gt;If you&amp;rsquo;re using self-managed Grafana and the OAuth App connection type for your provider isn&amp;rsquo;t available, add it to &lt;code&gt;connection_types&lt;/code&gt; in 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 connection types:&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]
connection_types = &amp;#34;github|githubOAuth|gitOAuth&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;p&gt;The available OAuth connection types are:&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;&lt;strong&gt;Connection type&lt;/strong&gt;&lt;/th&gt;
              &lt;th&gt;&lt;strong&gt;Provider&lt;/strong&gt;&lt;/th&gt;
              &lt;th&gt;&lt;strong&gt;Available in&lt;/strong&gt;&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;githubOAuth&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;GitHub&lt;/td&gt;
              &lt;td&gt;OSS, Enterprise&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;gitOAuth&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Pure Git&lt;/td&gt;
              &lt;td&gt;OSS, Enterprise&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;githubEnterpriseOAuth&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;GitHub Enterprise&lt;/td&gt;
              &lt;td&gt;Enterprise&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;gitlabOAuth&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;GitLab&lt;/td&gt;
              &lt;td&gt;Enterprise&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;bitbucketOAuth&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Bitbucket&lt;/td&gt;
              &lt;td&gt;Enterprise&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/section&gt;&lt;h2 id=&#34;network-connectivity-and-ip-allowlisting&#34;&gt;Network connectivity and IP allowlisting&lt;/h2&gt;
&lt;p&gt;Git Sync requires network connectivity between your Grafana instance and Git server. Understanding the traffic patterns helps you configure firewall rules and allowlists correctly.&lt;/p&gt;
&lt;h3 id=&#34;traffic-types&#34;&gt;Traffic types&lt;/h3&gt;
&lt;p&gt;Git Sync uses two types of network traffic:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Sync operations (pull and push)&lt;/strong&gt;: From Grafana to the Git Server
&lt;ul&gt;
&lt;li&gt;Egress traffic from Hosted Grafana IP addresses&lt;/li&gt;
&lt;li&gt;Your Git servers must allow inbound traffic from these IP addresses&lt;/li&gt;
&lt;li&gt;For a list of IP addresses to add to your Git server&amp;rsquo;s 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;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Webhooks (instantaneous sync)&lt;/strong&gt;: From the Git Server to Grafana stack
&lt;ul&gt;
&lt;li&gt;Inbound traffic to the stack&amp;rsquo;s public endpoint&lt;/li&gt;
&lt;li&gt;Your Git server must be able to reach &lt;code&gt;*.grafana.net&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Required only if you&amp;rsquo;re 
    &lt;a href=&#34;/docs/grafana/v13.3/as-code/git-sync/git-sync-setup/set-up-extend/&#34;&gt;using webhooks&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;aws-privatelink-and-private-data-source-connect&#34;&gt;AWS PrivateLink and Private Data Source Connect&lt;/h3&gt;
&lt;p&gt;Git Sync doesn&amp;rsquo;t route over AWS PrivateLink or Private Data Source Connect (PDC). Instead, Git Sync uses the normal public path from the Hosted Grafana IPs, which is independent from PrivateLink and PDC. AWS PrivateLink and PDC provide a separate tunnel for data source query traffic, from Grafana to your private databases or data sources.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;If you use AWS PrivateLink or PDC for data sources, you can still use Git Sync&lt;/strong&gt;. The two features neither interfere with nor depend on each other.&lt;/p&gt;
&lt;h2 id=&#34;allow-internal-or-private-git-servers&#34;&gt;Allow internal or private Git servers&lt;/h2&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;This setting is available for Grafana v13.0.4 and Grafana v13.1.1 and later. It only applies to self-managed Grafana (OSS and Enterprise), but it&amp;rsquo;s not configurable in Grafana Cloud.&lt;/p&gt;&lt;/blockquote&gt;&lt;/div&gt;

&lt;p&gt;While public Git servers such as &lt;code&gt;github.com&lt;/code&gt;, &lt;code&gt;gitlab.com&lt;/code&gt;, and &lt;code&gt;bitbucket.org&lt;/code&gt; resolve to public addresses and are always allowed, by default Git Sync rejects repository URLs with a host that resolves to a loopback, a private (RFC 1918), link-local, or an unspecified address. This protects your Grafana instance against server-side request forgery (SSRF).&lt;/p&gt;
&lt;p&gt;If you connect Git Sync to a Git server on a private network such as a self-hosted GitHub Enterprise, GitLab, or Bitbucket instance reachable only through an internal address, add its host to the &lt;code&gt;allowed_git_urls&lt;/code&gt; allowlist:&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 each internal Git host to &lt;code&gt;allowed_git_urls&lt;/code&gt; as a comma-separated list:&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]
allowed_git_urls = git.internal.example.com, ghe.example.com:8443&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;Each entry can be a hostname, &lt;code&gt;host:port&lt;/code&gt;, a full URL (only the host is used), a literal IP address, or a CIDR range. If possible, use specific hosts or narrow ranges, since a broad CIDR such as &lt;code&gt;10.0.0.0/8&lt;/code&gt; re-exposes the entire private range that SSRF protection blocks.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Only add hosts you trust&lt;/strong&gt; because an allowlisted host receives the configured Git token on every sync, fetch, and push.&lt;/p&gt;
&lt;h2 id=&#34;resource-and-role-permissions&#34;&gt;Resource and role permissions&lt;/h2&gt;
&lt;p&gt;By default, folders provisioned with Git Sync have these roles:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Admin = Admin&lt;/li&gt;
&lt;li&gt;Editor = Editor&lt;/li&gt;
&lt;li&gt;Viewer = Viewer.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Refer to 
    &lt;a href=&#34;/docs/grafana/v13.3/as-code/git-sync/permissions-grafana/&#34;&gt;Git Sync permissions&lt;/a&gt; for details on how to set up permissions in Git Sync. To modify them, refer to 
    &lt;a href=&#34;/docs/grafana/v13.3/as-code/git-sync/use-git-sync/#manage-folder-permissions&#34;&gt;Manage folder permissions&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Refer to 
    &lt;a href=&#34;/docs/grafana/v13.3/administration/roles-and-permissions/&#34;&gt;Roles and permissions&lt;/a&gt; for more information about Grafana roles.&lt;/p&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;Administration&lt;/strong&gt;: Read-only permission (enables validation of branch protection rules against the configured branch when users can push directly to it; may be used in the future to check other repository settings and make the setup process smoother)&lt;/li&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/v13.3/as-code/git-sync/git-sync-setup/&#34;&gt;Set up Git Sync&lt;/a&gt;!&lt;/p&gt;
&lt;h2 id=&#34;create-an-oauth-app&#34;&gt;Create an OAuth App&lt;/h2&gt;
&lt;p&gt;An OAuth App lets Grafana act on your behalf in your Git provider. You create the app in your provider, then authorize it once from Grafana. Grafana stores the access token and refreshes it when the provider supports refresh tokens.&lt;/p&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;An OAuth App connection acts as the user who authorized it. Every repository that uses the connection and every user who can run its sync jobs will use the access token of the user that authorized the connection. The token can reach every repository that user can access, not only those connected to Grafana. Removing the user from Grafana doesn&amp;rsquo;t revoke the token. Revoke it in your Git provider.&lt;/p&gt;
&lt;p&gt;To limit access, authorize the app with a dedicated account that can only access the repositories you sync. For GitHub, consider a GitHub App, which is scoped to the repositories where it&amp;rsquo;s installed.&lt;/p&gt;&lt;/blockquote&gt;&lt;/div&gt;

&lt;p&gt;If you chose to authenticate with an OAuth App, you need the following parameters:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;The client ID of the app.&lt;/li&gt;
&lt;li&gt;The client secret of the app.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Every OAuth App needs the Grafana callback URL. Grafana shows it in the setup wizard, and it has this format:&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;text&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-text&#34;&gt;&amp;lt;GRAFANA_URL&amp;gt;/admin/provisioning/connections/oauth-callback&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Replace &lt;em&gt;&lt;code&gt;&amp;lt;GRAFANA_URL&amp;gt;&lt;/code&gt;&lt;/em&gt; with the root URL of your Grafana instance, including any sub-path.&lt;/p&gt;
&lt;p&gt;The following instructions are informative only. Always refer to the official documentation of your Git provider for more details.&lt;/p&gt;
&lt;h3 id=&#34;github-and-github-enterprise&#34;&gt;GitHub and GitHub Enterprise&lt;/h3&gt;
&lt;p&gt;To create a GitHub OAuth App, follow these steps:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;In GitHub, go to &lt;strong&gt;Settings &amp;gt; Developer settings &amp;gt; OAuth apps&lt;/strong&gt; and click &lt;strong&gt;New OAuth App&lt;/strong&gt;. For GitHub Enterprise, use the same menu on your enterprise instance.&lt;/li&gt;
&lt;li&gt;Enter an &lt;strong&gt;Application name&lt;/strong&gt; and a &lt;strong&gt;Homepage URL&lt;/strong&gt;, for example your Grafana instance URL.&lt;/li&gt;
&lt;li&gt;Paste the Grafana callback URL in &lt;strong&gt;Authorization callback URL&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Click &lt;strong&gt;Register application&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Copy the &lt;strong&gt;Client ID&lt;/strong&gt;, then click &lt;strong&gt;Generate a new client secret&lt;/strong&gt; and copy the secret.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Grafana requests the &lt;code&gt;repo&lt;/code&gt; scope when you authorize the app. For more details, refer to &lt;a href=&#34;https://docs.github.com/en/apps/oauth-apps/building-oauth-apps/creating-an-oauth-app&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;Creating an OAuth app&lt;/a&gt;.&lt;/p&gt;
&lt;h3 id=&#34;gitlab&#34;&gt;GitLab&lt;/h3&gt;
&lt;p&gt;To create a GitLab OAuth application, follow these steps:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;In GitLab, create the application for your user or for a group:
&lt;ul&gt;
&lt;li&gt;For your user, select your avatar, then &lt;strong&gt;Edit profile &amp;gt; Access &amp;gt; Applications &amp;gt; Add new application&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;For a group, go to the group and select &lt;strong&gt;Settings &amp;gt; Applications&lt;/strong&gt;.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Enter a &lt;strong&gt;Name&lt;/strong&gt; and paste the Grafana callback URL in &lt;strong&gt;Redirect URI&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Keep &lt;strong&gt;Confidential&lt;/strong&gt; selected, and select the &lt;code&gt;api&lt;/code&gt; scope.&lt;/li&gt;
&lt;li&gt;Click &lt;strong&gt;Save application&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Copy the &lt;strong&gt;Application ID&lt;/strong&gt; and the &lt;strong&gt;Secret&lt;/strong&gt;.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;For more details, refer to &lt;a href=&#34;https://docs.gitlab.com/integration/oauth_provider/&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;Configure GitLab as an OAuth 2.0 authentication identity provider&lt;/a&gt;.&lt;/p&gt;
&lt;h3 id=&#34;bitbucket&#34;&gt;Bitbucket&lt;/h3&gt;
&lt;p&gt;To create a Bitbucket OAuth consumer, follow these steps:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;In Bitbucket, go to &lt;strong&gt;Workspace settings &amp;gt; Apps and features &amp;gt; OAuth consumers&lt;/strong&gt; and click &lt;strong&gt;Add consumer&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Enter a &lt;strong&gt;Name&lt;/strong&gt; and paste the Grafana callback URL in &lt;strong&gt;Callback URL&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Set these permissions:
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Repositories&lt;/strong&gt;: Read and write 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;Click &lt;strong&gt;Save&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Select the consumer name to show the &lt;strong&gt;Key&lt;/strong&gt; and the &lt;strong&gt;Secret&lt;/strong&gt;, copy them, and note the name of the workspace.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;For more details, refer to &lt;a href=&#34;https://support.atlassian.com/bitbucket-cloud/docs/use-oauth-on-bitbucket-cloud/&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;Use OAuth on Bitbucket Cloud&lt;/a&gt;.&lt;/p&gt;
&lt;h3 id=&#34;other-git-providers&#34;&gt;Other Git providers&lt;/h3&gt;
&lt;p&gt;For any other Git provider that supports the OAuth 2.0 authorization code flow, create an OAuth application with the Grafana callback URL as the redirect URI. In addition to the client ID and secret, you need:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;The &lt;strong&gt;Authorization URL&lt;/strong&gt; of the provider, for example &lt;code&gt;https://git.example.com/oauth/authorize&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;The &lt;strong&gt;Token URL&lt;/strong&gt; of the provider, for example &lt;code&gt;https://git.example.com/oauth/token&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;The &lt;strong&gt;Scopes&lt;/strong&gt; that grant read and write access to your repositories. Refer to your provider&amp;rsquo;s documentation.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Both URLs must use &lt;code&gt;https://&lt;/code&gt;, unless you set &lt;code&gt;allow_insecure&lt;/code&gt; in the &lt;code&gt;[provisioning]&lt;/code&gt; section of your configuration file.&lt;/p&gt;
&lt;h2 id=&#34;next-steps&#34;&gt;Next steps&lt;/h2&gt;
&lt;p&gt;For further details on how Git Sync operates, refer to:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
    &lt;a href=&#34;/docs/grafana/v13.3/as-code/git-sync/key-concepts/&#34;&gt;Git Sync key concepts&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;
    &lt;a href=&#34;/docs/grafana/v13.3/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/v13.3/as-code/git-sync/usage-limits/&#34;&gt;Git Sync usage and performance limitations&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
]]></content><description>&lt;h1 id="before-you-begin">Before you begin&lt;/h1>
&lt;p>Before you begin to set up Git Sync, ensure you have the following:&lt;/p>
&lt;ul>
&lt;li>A Grafana instance (Cloud, OSS, or Enterprise)&lt;/li>
&lt;li>Administration rights in your Grafana organization&lt;/li>
&lt;li>A
&lt;a href="/docs/grafana/v13.3/as-code/git-sync/usage-limits/#compatible-providers">Git provider&lt;/a>&lt;/li>
&lt;li>If you&amp;rsquo;re
&lt;a href="/docs/grafana/v13.3/as-code/git-sync/git-sync-setup/set-up-extend/">using webhooks or image rendering&lt;/a>, a public instance with external access&lt;/li>
&lt;li>Optional: The &lt;a href="https://github.com/grafana/grafana-image-renderer" target="_blank" rel="noopener noreferrer">Image Renderer service&lt;/a> to save image previews with your PRs&lt;/li>
&lt;/ul>
&lt;h2 id="enable-required-feature-toggles">Enable required feature toggles&lt;/h2>
&lt;p>The &lt;code>provisioning&lt;/code> feature toggle is enabled by default in Grafana Cloud and, starting in Grafana v13, for OSS and Enterprise as well. No manual configuration is required.&lt;/p></description></item><item><title>Set up Git Sync as code</title><link>https://grafana.com/docs/grafana/v13.3/as-code/git-sync/git-sync-setup/set-up-code/</link><pubDate>Tue, 03 Nov 2026 16:35:21 +0000</pubDate><guid>https://grafana.com/docs/grafana/v13.3/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;p&gt;You can also configure Git Sync using &lt;code&gt;gcx&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;gcx&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/v13.3/as-code/git-sync/key-concepts/#git-sync-repository-resource&#34;&gt;Repository resource&lt;/a&gt; and 
    &lt;a href=&#34;/docs/grafana/v13.3/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/v13.3/as-code/git-sync/add-resources/dashboards-migrate/&#34;&gt;Dashboard CRD Format&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;
    &lt;a href=&#34;/docs/grafana/v13.3/ai-tools/grafana-cli/&#34;&gt;Grafana CLI documentation&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;To provision resources from a local file system as code instead of a Git repository, refer to 
    &lt;a href=&#34;/docs/grafana/v13.3/as-code/provision-resources/file-path-setup/#set-up-file-provisioning-as-code&#34;&gt;Set up file provisioning as code&lt;/a&gt;.&lt;/p&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;gcx&lt;/code&gt;, follow these steps:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Read &lt;a href=&#34;#before-you-begin&#34;&gt;Before you begin&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;#create-the-connection-resource&#34;&gt;Create the connection resource&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;#create-the-repository-resource&#34;&gt;Create the repository resource&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;#push-the-resources-to-grafana&#34;&gt;Push the resources 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;before-you-begin&#34;&gt;Before you begin&lt;/h2&gt;
&lt;p&gt;Understand the following:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Git Sync 
    &lt;a href=&#34;/docs/grafana/v13.3/as-code/git-sync/usage-limits/&#34;&gt;Usage and performance limitations&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;The 
    &lt;a href=&#34;/docs/grafana/v13.3/as-code/git-sync/key-concepts/&#34;&gt;required resources (connection and repository)&lt;/a&gt; to use Git Sync.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;create-the-connection-resource&#34;&gt;Create the connection resource&lt;/h2&gt;
&lt;p&gt;A connection is the authentication setup between Grafana and an external Git provider, required when you&amp;rsquo;re not using a Personal Access Token or a static token to authenticate.&lt;/p&gt;
&lt;h3 id=&#34;create-a-github-app-connection-resource&#34;&gt;Create a GitHub App 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;If your GitHub App is installed on GitHub Enterprise Server, set the type to &lt;code&gt;githubEnterprise&lt;/code&gt; and use the &lt;code&gt;githubEnterprise&lt;/code&gt; block instead:&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: githubEnterprise
  githubEnterprise:
    appID: &amp;#39;&amp;lt;GITHUB_APP_ID&amp;gt;&amp;#39;
    installationID: &amp;#39;&amp;lt;GITHUB_INSTALL_ID&amp;gt;&amp;#39;
    serverUrl: &amp;#39;&amp;lt;GITHUB_ENTERPRISE_SERVER_URL&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 App private key, base64-encoded&lt;/li&gt;
&lt;li&gt;&lt;em&gt;&lt;code&gt;&amp;lt;GITHUB_ENTERPRISE_SERVER_URL&amp;gt;&lt;/code&gt;&lt;/em&gt;: The URL of your GitHub Enterprise Server instance, for example &lt;code&gt;https://ghes.example.com&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;create-an-oauth-app-connection-resource&#34;&gt;Create an OAuth App connection resource&lt;/h3&gt;
&lt;p&gt;If you&amp;rsquo;re connecting Git Sync with an 
    &lt;a href=&#34;/docs/grafana/v13.3/as-code/git-sync/git-sync-setup/set-up-before/#create-an-oauth-app&#34;&gt;OAuth App&lt;/a&gt;, create a &lt;code&gt;connection.yaml&lt;/code&gt; file with the client ID and secret of the app, and the fields for your provider:&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;OAUTH_CONNECTION_NAME&amp;gt;&amp;#39;
  namespace: default
spec:
  title: &amp;#39;&amp;lt;CONNECTION_TITLE&amp;gt;&amp;#39;
  type: &amp;#39;&amp;lt;CONNECTION_TYPE&amp;gt;&amp;#39; # githubOAuth, githubEnterpriseOAuth, gitlabOAuth, bitbucketOAuth, or gitOAuth
  oauth:
    clientID: &amp;#39;&amp;lt;CLIENT_ID&amp;gt;&amp;#39;
  # GitHub Enterprise only:
  githubEnterpriseOAuth:
    serverUrl: &amp;#39;&amp;lt;GITHUB_ENTERPRISE_SERVER_URL&amp;gt;&amp;#39;
  # Bitbucket only:
  bitbucket:
    workspace: &amp;#39;&amp;lt;BITBUCKET_WORKSPACE&amp;gt;&amp;#39;
  # Pure Git only:
  gitOAuth:
    authURL: &amp;#39;&amp;lt;AUTHORIZATION_URL&amp;gt;&amp;#39;
    tokenURL: &amp;#39;&amp;lt;TOKEN_URL&amp;gt;&amp;#39;
    scopes:
      - &amp;#39;&amp;lt;SCOPE&amp;gt;&amp;#39;
secure:
  clientSecret:
    create: &amp;#39;&amp;lt;CLIENT_SECRET&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;OAUTH_CONNECTION_NAME&amp;gt;&lt;/code&gt;&lt;/em&gt;: The name of your OAuth App connection&lt;/li&gt;
&lt;li&gt;&lt;em&gt;&lt;code&gt;&amp;lt;CONNECTION_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;CONNECTION_TYPE&amp;gt;&lt;/code&gt;&lt;/em&gt;: The OAuth connection type for your provider&lt;/li&gt;
&lt;li&gt;&lt;em&gt;&lt;code&gt;&amp;lt;CLIENT_ID&amp;gt;&lt;/code&gt;&lt;/em&gt;: The client ID of the OAuth App&lt;/li&gt;
&lt;li&gt;&lt;em&gt;&lt;code&gt;&amp;lt;CLIENT_SECRET&amp;gt;&lt;/code&gt;&lt;/em&gt;: The client secret of the OAuth App&lt;/li&gt;
&lt;li&gt;&lt;em&gt;&lt;code&gt;&amp;lt;GITHUB_ENTERPRISE_SERVER_URL&amp;gt;&lt;/code&gt;&lt;/em&gt;: The URL of your GitHub Enterprise instance&lt;/li&gt;
&lt;li&gt;&lt;em&gt;&lt;code&gt;&amp;lt;BITBUCKET_WORKSPACE&amp;gt;&lt;/code&gt;&lt;/em&gt;: The workspace that the OAuth consumer belongs to&lt;/li&gt;
&lt;li&gt;&lt;em&gt;&lt;code&gt;&amp;lt;AUTHORIZATION_URL&amp;gt;&lt;/code&gt;&lt;/em&gt;, &lt;em&gt;&lt;code&gt;&amp;lt;TOKEN_URL&amp;gt;&lt;/code&gt;&lt;/em&gt;, &lt;em&gt;&lt;code&gt;&amp;lt;SCOPE&amp;gt;&lt;/code&gt;&lt;/em&gt;: The OAuth endpoints of your Git provider, and the scopes that grant read and write access to your repositories&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;An OAuth App connection needs a user to approve access in the browser. After you push the connection, it shows as &lt;strong&gt;Disconnected&lt;/strong&gt; until you authorize it:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Select &lt;strong&gt;Administration &amp;gt; General &amp;gt; Provisioning&lt;/strong&gt; and go to the &lt;strong&gt;Connections&lt;/strong&gt; tab.&lt;/li&gt;
&lt;li&gt;Select the connection and click &lt;strong&gt;Reauthorize&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Approve the access in the provider tab that opens.&lt;/li&gt;
&lt;/ol&gt;
&lt;h2 id=&#34;create-the-repository-resource&#34;&gt;Create the repository resource&lt;/h2&gt;
&lt;p&gt;A repository resource is a Grafana configuration object that defines the connection between a group of repositories and your Grafana instance via Git Sync. Depending on your Git provider and authentication method, add your Personal Access Token information or the connection name.&lt;/p&gt;
&lt;p&gt;Create a &lt;code&gt;repository.yaml&lt;/code&gt; file defining your Git Sync 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: Repository
metadata:
  name: &amp;#39;&amp;lt;REPOSITORY_NAME&amp;gt;&amp;#39;
spec:
  sync:
    enabled: true
    intervalSeconds: 60
    target: &amp;#39;&amp;lt;YOUR_TARGET&amp;#39;&amp;gt;
  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 or OAuth 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;#39;GIT_PAT&amp;#39; }

# Git Sync for GitHub Enterprise:
spec:
  type: githubEnterprise
  githubEnterprise:
    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 Enterprise App connection only:
  connection:
    name: &amp;#39;&amp;lt;GITHUB_ENTERPRISE_CONNECTION_NAME&amp;gt;&amp;#39;
# GitHub Personal Access Token only:
secure:
  token: { create: &amp;#39;GIT_PAT&amp;#39; }

# 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;#39;GIT_PAT&amp;#39; }

# 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;#39;GIT_PAT&amp;#39; }

# 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;#39;grafana/&amp;#39;
    tokenUser: tokenuser
secure:
  token: { create: &amp;#39;GIT_PAT&amp;#39; }&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;To use an OAuth App connection, set &lt;code&gt;spec.connection.name&lt;/code&gt; instead of &lt;code&gt;secure.token&lt;/code&gt;. The repository type must match the connection type: &lt;code&gt;githubOAuth&lt;/code&gt; for &lt;code&gt;github&lt;/code&gt;, &lt;code&gt;githubEnterpriseOAuth&lt;/code&gt; for &lt;code&gt;githubEnterprise&lt;/code&gt;, &lt;code&gt;gitlabOAuth&lt;/code&gt; for &lt;code&gt;gitlab&lt;/code&gt;, &lt;code&gt;bitbucketOAuth&lt;/code&gt; for &lt;code&gt;bitbucket&lt;/code&gt;, and &lt;code&gt;gitOAuth&lt;/code&gt; for &lt;code&gt;git&lt;/code&gt;.&lt;/p&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;YOUR_TARGET&amp;gt;&lt;/code&gt;&lt;/em&gt;: Git Sync supports two sync targets: &lt;code&gt;folder&lt;/code&gt; (default) creates a folder named after the repository and places synced resources inside it, while &lt;code&gt;folderless&lt;/code&gt; places synced resources at the top level without creating a wrapper folder. Refer to 
    &lt;a href=&#34;/docs/grafana/v13.3/as-code/git-sync/key-concepts/#sync-targets&#34;&gt;Sync targets&lt;/a&gt; for details.&lt;/li&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;GITHUB_ENTERPRISE_CONNECTION_NAME&amp;gt;&lt;/code&gt;&lt;/em&gt;: The name of your GitHub Enterprise 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;h2 id=&#34;configuration-parameters&#34;&gt;Configuration parameters&lt;/h2&gt;
&lt;p&gt;The following configuration parameters are available for the connection and repository resources.&lt;/p&gt;
&lt;p&gt;Values under &lt;code&gt;secure&lt;/code&gt; are stored encrypted and can&amp;rsquo;t be read back after you create them.&lt;/p&gt;
&lt;h3 id=&#34;connection-parameters&#34;&gt;Connection parameters&lt;/h3&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 connection resource. Repositories reference the connection by this name&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.description&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Description of the connection&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;Connection type: &lt;code&gt;github&lt;/code&gt;, &lt;code&gt;githubEnterprise&lt;/code&gt;, &lt;code&gt;githubOAuth&lt;/code&gt;, &lt;code&gt;githubEnterpriseOAuth&lt;/code&gt;, &lt;code&gt;gitlabOAuth&lt;/code&gt;, &lt;code&gt;bitbucketOAuth&lt;/code&gt;, or &lt;code&gt;gitOAuth&lt;/code&gt;&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;spec.url&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;URL of the Git provider, for example &lt;code&gt;https://github.com&lt;/code&gt;&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;spec.github.appID&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;GitHub App ID. Only for the &lt;code&gt;github&lt;/code&gt; type&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;spec.github.installationID&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;GitHub App installation ID. Only for the &lt;code&gt;github&lt;/code&gt; type&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;spec.githubEnterprise.appID&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;GitHub App ID. Only for the &lt;code&gt;githubEnterprise&lt;/code&gt; type&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;spec.githubEnterprise.installationID&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;GitHub App installation ID. Only for the &lt;code&gt;githubEnterprise&lt;/code&gt; type&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;spec.githubEnterprise.serverUrl&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;URL of your GitHub Enterprise Server instance, for example &lt;code&gt;https://ghes.example.com&lt;/code&gt;. Only for the &lt;code&gt;githubEnterprise&lt;/code&gt; type&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;spec.oauth.clientID&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Client ID of the OAuth App. Required for all OAuth connection types&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;spec.githubEnterpriseOAuth.serverUrl&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;URL of your GitHub Enterprise Server instance. Only for the &lt;code&gt;githubEnterpriseOAuth&lt;/code&gt; type&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;spec.bitbucket.workspace&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Workspace that the OAuth consumer belongs to. Only for the &lt;code&gt;bitbucketOAuth&lt;/code&gt; type&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;spec.gitOAuth.authURL&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;OAuth authorization endpoint of your Git provider, for example &lt;code&gt;https://gitlab.example.com/oauth/authorize&lt;/code&gt;. Only for the &lt;code&gt;gitOAuth&lt;/code&gt; type&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;spec.gitOAuth.tokenURL&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;OAuth token endpoint of your Git provider, for example &lt;code&gt;https://gitlab.example.com/oauth/token&lt;/code&gt;. Only for the &lt;code&gt;gitOAuth&lt;/code&gt; type&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;spec.gitOAuth.scopes&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;OAuth scopes to request. The scopes must grant read and write access to your repositories. Only for the &lt;code&gt;gitOAuth&lt;/code&gt; type&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;spec.webhook.disabled&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Disable webhooks for this connection (true/false). When &lt;code&gt;true&lt;/code&gt;, the GitHub App doesn&amp;rsquo;t need the &lt;code&gt;webhooks:write&lt;/code&gt; permission, and Grafana doesn&amp;rsquo;t register or receive webhook events. Use it if Grafana isn&amp;rsquo;t reachable from the public internet&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;secure.privateKey.create&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Private key of the GitHub App, base64-encoded. Only for the &lt;code&gt;github&lt;/code&gt; and &lt;code&gt;githubEnterprise&lt;/code&gt; types&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;secure.clientSecret.create&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Client secret of the OAuth App. Required for all OAuth connection types&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/section&gt;&lt;h3 id=&#34;repository-parameters&#34;&gt;Repository parameters&lt;/h3&gt;
&lt;p&gt;In the following table, replace &lt;code&gt;&amp;lt;TYPE&amp;gt;&lt;/code&gt; with the repository type set in &lt;code&gt;spec.type&lt;/code&gt;. For example, use &lt;code&gt;spec.gitlab.url&lt;/code&gt; for a GitLab repository.&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.description&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Description of the repository&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;code&gt;githubEnterprise&lt;/code&gt;, &lt;code&gt;gitlab&lt;/code&gt;, &lt;code&gt;bitbucket&lt;/code&gt;, or &lt;code&gt;git&lt;/code&gt;&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;spec.&amp;lt;TYPE&amp;gt;.url&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Repository URL, for example &lt;code&gt;https://github.com/example/test&lt;/code&gt;&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;spec.&amp;lt;TYPE&amp;gt;.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.&amp;lt;TYPE&amp;gt;.path&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Directory path in the repository that contains your Grafana resources, for example &lt;code&gt;grafana/&lt;/code&gt;. Grafana ignores anything outside this path&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;spec.githubEnterprise.serverUrl&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;URL of your GitHub Enterprise Server instance, for example &lt;code&gt;https://ghes.example.com&lt;/code&gt;&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;spec.bitbucket.tokenUser&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;User that owns the Personal Access Token&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;spec.bitbucket.email&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Atlassian account email used to authenticate with the Bitbucket REST API. Required to enable webhooks&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;spec.git.tokenUser&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;User that owns the Personal Access Token&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 dashboard preview images in pull requests (true/false). Only for the &lt;code&gt;github&lt;/code&gt; type. For other types, use &lt;code&gt;spec.pullRequest.generateDashboardPreviews&lt;/code&gt;&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;spec.connection.name&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Name of the connection resource used to authenticate. Use it instead of &lt;code&gt;secure.token&lt;/code&gt; when you connect with a GitHub App or an OAuth App&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. If the value is lower than the system minimum, Grafana uses the system minimum instead&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 resources (&lt;code&gt;folder&lt;/code&gt; or &lt;code&gt;folderless&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). The order defines which workflow takes precedence. If empty, the repository is read-only&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;spec.commit.singleResourceMessageTemplate&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Template for the commit messages of single-resource operations in the Grafana UI, such as saving, moving, or deleting a dashboard. Supports &lt;code&gt;{{action}}&lt;/code&gt;, &lt;code&gt;{{resourceKind}}&lt;/code&gt;, &lt;code&gt;{{resourceID}}&lt;/code&gt;, &lt;code&gt;{{title}}&lt;/code&gt;, &lt;code&gt;{{userName}}&lt;/code&gt;, &lt;code&gt;{{userLogin}}&lt;/code&gt;, and &lt;code&gt;{{userEmail}}&lt;/code&gt;. If empty, Grafana uses a default message, for example &lt;code&gt;Save dashboard: &amp;lt;TITLE&amp;gt;&lt;/code&gt;&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;spec.commit.enforceTemplate&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Pre-fill the comment field in the save drawer from the commit message template and make it read-only (true/false)&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;spec.commit.authorName&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Name used as the commit author instead of the user who made the change. Only valid if &lt;code&gt;spec.commit.signingMethod&lt;/code&gt; isn&amp;rsquo;t set&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;spec.commit.authorEmail&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Email used as the commit author instead of the user who made the change. Only valid if &lt;code&gt;spec.commit.signingMethod&lt;/code&gt; isn&amp;rsquo;t set&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;spec.commit.signingMethod&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Method used to sign commits with the key in &lt;code&gt;secure.commitSigningKey&lt;/code&gt;: &lt;code&gt;gpg&lt;/code&gt;, &lt;code&gt;ssh&lt;/code&gt;, or &lt;code&gt;smime&lt;/code&gt;. If empty, commits aren&amp;rsquo;t signed&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;spec.commit.signerName&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Name of the commit signer. Must match the identity of the signing key for your Git provider to mark commits as verified. Defaults to &lt;code&gt;Grafana&lt;/code&gt;&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;spec.commit.signerEmail&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Email of the commit signer. Must match the identity of the signing key, and a verified email on the account where the matching public key is registered. Defaults to &lt;code&gt;noreply@grafana.com&lt;/code&gt;&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;spec.commit.signerIsAuthor&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Use the signer identity (&lt;code&gt;signerName&lt;/code&gt; and &lt;code&gt;signerEmail&lt;/code&gt;) as the commit author (true/false)&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;spec.commit.smimeCertificate&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;PEM-encoded X.509 certificate paired with the signing key. Only used if &lt;code&gt;spec.commit.signingMethod&lt;/code&gt; is &lt;code&gt;smime&lt;/code&gt;&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;spec.branch.nameTemplate&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Template for the names of branches created by the &lt;code&gt;branch&lt;/code&gt; workflow. Supports &lt;code&gt;{{action}}&lt;/code&gt;, &lt;code&gt;{{resourceKind}}&lt;/code&gt;, &lt;code&gt;{{title}}&lt;/code&gt;, &lt;code&gt;{{userLogin}}&lt;/code&gt;, and &lt;code&gt;{{random}}&lt;/code&gt;, a random 6-character string. Grafana converts the result to a valid branch name of up to 100 characters&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;spec.branch.enforceTemplate&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Make the branch name field in the save drawer read-only (true/false)&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;spec.pullRequest.titleTemplate&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Template for pull request titles. Supports the same variables as &lt;code&gt;spec.branch.nameTemplate&lt;/code&gt;. If empty, Grafana uses the first line of the commit message&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;spec.pullRequest.enforceTemplate&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Make the pull request title field in the save drawer read-only (true/false)&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;spec.pullRequest.generateDashboardPreviews&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Generate dashboard preview images in pull requests (true/false). For all types except &lt;code&gt;github&lt;/code&gt;&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;spec.webhook.baseUrl&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Base URL of your Grafana instance used to register webhooks with your Git provider, for example &lt;code&gt;https://grafana.example.com&lt;/code&gt;. Overrides the auto-detected public URL of Grafana&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;spec.webhook.disabled&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Disable webhooks for this repository (true/false). When &lt;code&gt;true&lt;/code&gt;, Grafana polls the repository at the sync interval instead. Use it if Grafana isn&amp;rsquo;t reachable from the public internet&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;Personal Access Token of your Git provider. Not needed if you use &lt;code&gt;spec.connection.name&lt;/code&gt;&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;secure.commitSigningKey.create&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Private key used to sign the commits Grafana writes to the repository. The format depends on &lt;code&gt;spec.commit.signingMethod&lt;/code&gt;&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/section&gt;&lt;h2 id=&#34;push-the-resources-to-grafana&#34;&gt;Push the resources to Grafana&lt;/h2&gt;
&lt;p&gt;Before pushing any resources, configure &lt;code&gt;gcx&lt;/code&gt; with your Grafana instance details. Refer to the 
    &lt;a href=&#34;/docs/grafana/v13.3/ai-tools/grafana-cli/&#34;&gt;Grafana CLI documentation&lt;/a&gt; for setup instructions.&lt;/p&gt;
&lt;p&gt;Next, push the connection (if required) and repository configuration files:&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;gcx 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; and &lt;code&gt;connection.yaml&lt;/code&gt; files.&lt;/p&gt;
&lt;p&gt;After pushing, Grafana will:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Create the required resources (repository and, for GitHub App or OAuth, connection).&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;gcx 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;gcx resources get repository/&amp;lt;REPOSITORY_NAME&amp;gt;
gcx resources get repository/&amp;lt;REPOSITORY_NAME&amp;gt; -o json
gcx 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;gcx 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;gcx 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
gcx 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;p>You can also configure Git Sync using &lt;code>gcx&lt;/code>, 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>gcx&lt;/code>. This approach enables automated, GitOps-style workflows for managing Git Sync configuration instead of using the Grafana UI.&lt;/p></description></item><item><title>Set up Git Sync with Terraform</title><link>https://grafana.com/docs/grafana/v13.3/as-code/git-sync/git-sync-setup/set-up-terraform/</link><pubDate>Tue, 03 Nov 2026 16:35:21 +0000</pubDate><guid>https://grafana.com/docs/grafana/v13.3/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;p&gt;You can configure Git Sync via the Grafana provisioning app platform using Terraform.&lt;/p&gt;
&lt;p&gt;To do so, follow these steps:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Read &lt;a href=&#34;#before-you-begin&#34;&gt;Before you begin&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;#configure-the-grafana-terraform-provider&#34;&gt;Configure the Grafana Terraform provider&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;#create-the-resources-to-use-git-sync&#34;&gt;Create the resources for Git Sync&lt;/a&gt;.&lt;/li&gt;
&lt;/ol&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;p&gt;You need the three files described in this document to set up Git Sync with Terraform:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;#configure-the-grafana-terraform-provider&#34;&gt;Grafana provider configuration file&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;#configure-the-connection-resource&#34;&gt;Connection resource&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;#configure-the-repository-resource&#34;&gt;Repository resource&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;strong&gt;Save all of them in the same directory.&lt;/strong&gt;&lt;/p&gt;
&lt;h2 id=&#34;configure-the-grafana-terraform-provider&#34;&gt;Configure the Grafana Terraform provider&lt;/h2&gt;
&lt;p&gt;Configure 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 Terraform provider&lt;/a&gt; with the authentication required to set up 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/terraform/terraform-cloud-stack/&#34;&gt;Create and manage 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; {
     url = &amp;#34;https://&amp;#39;&amp;lt;STACK_URL&amp;gt;&amp;#39;.grafana.net/&amp;#34;
     auth = &amp;#34;&amp;lt;YOUR_SERVICE_ACCOUNT_TOKEN&amp;gt;&amp;#34;
     stack_id = &amp;#34;&amp;lt;YOUR_STACK_ID&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;em&gt;&lt;code&gt;&amp;lt;STACK_URL&amp;gt;&lt;/code&gt;&lt;/em&gt;: 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;em&gt;&lt;code&gt;&amp;lt;YOUR_SERVICE_ACCOUNT_TOKEN&amp;gt;&lt;/code&gt;&lt;/em&gt;: The service account token that you created, or &lt;code&gt;&amp;lt;USERNAME&amp;gt;:&amp;lt;PASSWORD&amp;gt;&lt;/code&gt; for basic auth.&lt;/li&gt;
&lt;li&gt;&lt;em&gt;&lt;code&gt;&amp;lt;YOUR_STACK_ID&amp;gt;&lt;/code&gt;&lt;/em&gt;: The Grafana stack ID, if you&amp;rsquo;re using a Grafana Cloud stack.&lt;/li&gt;
&lt;/ul&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;&lt;strong&gt;Don&amp;rsquo;t use your Grafana Cloud provider settings in this configuration&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;The Git Sync resources are App Platform resources and talk directly to the Grafana stack&amp;rsquo;s API. Configure the Terraform provider with &lt;code&gt;url&lt;/code&gt; and &lt;code&gt;auth&lt;/code&gt;, not &lt;code&gt;cloud_api_url&lt;/code&gt; nor &lt;code&gt;cloud_access_policy_token&lt;/code&gt;. If you&amp;rsquo;re using Grafana Cloud, set &lt;code&gt;stack_id&lt;/code&gt; to your stack ID.&lt;/p&gt;&lt;/blockquote&gt;&lt;/div&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 to create one or two resources to configure and manage Git Sync:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;The &lt;a href=&#34;#configure-the-connection-resource&#34;&gt;connection resource&lt;/a&gt; configures your Git provider credentials. This resource is only needed if you&amp;rsquo;re connecting with OAuth or GitHub App.&lt;/li&gt;
&lt;li&gt;The &lt;a href=&#34;#configure-the-repository-resource&#34;&gt;repository resource&lt;/a&gt; configures the Git repository to sync Grafana resources with.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;For better understanding of the required resources, refer to 
    &lt;a href=&#34;/docs/grafana/v13.3/as-code/git-sync/key-concepts/&#34;&gt;Git Sync key concepts&lt;/a&gt;.&lt;/p&gt;
&lt;h3 id=&#34;configure-the-connection-resource&#34;&gt;Configure the Connection resource&lt;/h3&gt;
&lt;p&gt;The Connection resource manages the Git Sync connections used by repositories for provider authentication.&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;resource &amp;#34;grafana_apps_provisioning_connection_v0alpha1&amp;#34; &amp;#34;example&amp;#34; {
  metadata {
    uid = &amp;#34;my-connection&amp;#34;
  }

  spec {
    title       = &amp;#34;My Connection&amp;#34;
    description = &amp;#34;Connection used by a folder-scoped Git Sync repository&amp;#34;
    type        = &amp;#34;&amp;lt;CONNECTION_TYPE&amp;gt;&amp;#34; # githubOAuth, githubEnterpriseOAuth, gitlabOAuth, bitbucketOAuth, or gitOAuth
    url         = &amp;#34;https://connection.com&amp;#34;
  }

  secure {
    private_key = {
      create = filebase64(&amp;#34;${path.module}/private-key.pem&amp;#34;)
    }
  }
  secure_version = 1
}&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Replace the following field values:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;em&gt;&lt;code&gt;&amp;lt;CONNECTION_TYPE&amp;gt;&lt;/code&gt;&lt;/em&gt;: The Git provider type. Possible values are &lt;code&gt;githubOAuth&lt;/code&gt;, &lt;code&gt;githubEnterpriseOAuth&lt;/code&gt;, &lt;code&gt;gitlabOAuth&lt;/code&gt;, &lt;code&gt;bitbucketOAuth&lt;/code&gt;, and &lt;code&gt;gitOAuth&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;For more details, optional fields, and 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;/p&gt;
&lt;h3 id=&#34;configure-the-repository-resource&#34;&gt;Configure the Repository resource&lt;/h3&gt;
&lt;p&gt;The Repository resource manages your Git Sync repositories for provisioning dashboards and related resources.&lt;/p&gt;
&lt;p&gt;For example, for a GitHub repository with token authentication:&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;resource &amp;#34;grafana_apps_provisioning_repository_v0alpha1&amp;#34; &amp;#34;example&amp;#34; {
  metadata {
    uid = &amp;#34;my-github-folder-repo&amp;#34;
  }

  spec {
    title       = &amp;#34;My GitHub Folder Repository&amp;#34;
    description = &amp;#34;Folder-scoped GitHub repository authenticated directly with a token&amp;#34;
    type        = &amp;#34;github&amp;#34;

    workflows = &amp;#34;&amp;lt;YOUR-WORKFLOWS&amp;gt;&amp;#34; # For example, [&amp;#34;write&amp;#34;, &amp;#34;branch&amp;#34;]

    sync {
      enabled          = &amp;#34;&amp;lt;SYNC_ENABLED&amp;gt;&amp;#34;
      target           = &amp;#34;&amp;lt;YOUR_SYNC_TARGET&amp;gt;&amp;#34;
      interval_seconds = &amp;#34;&amp;lt;SYNC_INTERVAL&amp;gt;&amp;#34;
    }

    github {
      url    = &amp;#34;&amp;lt;YOUR_GITHUB_REPO_URL&amp;gt;&amp;#34;
      branch = &amp;#34;&amp;lt;SYNC_BRANCH&amp;gt;&amp;#34;
      path   = &amp;#34;grafanatftest&amp;#34;
    }

    webhook {
      base_url = &amp;#34;https://grafana.example.com&amp;#34;
    }
  }

  secure {
    token = {
      create = &amp;#34;replace-me&amp;#34;
    }
  }
  secure_version = 1
}&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Replace the following field values:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;em&gt;&lt;code&gt;&amp;lt;YOUR_WORKFLOWS&amp;gt;&lt;/code&gt;&lt;/em&gt;: Array with the workflows you want Git Sync to use. For example, &lt;code&gt;[&amp;quot;write&amp;quot;, &amp;quot;branch&amp;quot;]&lt;/code&gt;. Use &lt;code&gt;write&lt;/code&gt; to allow direct commits, &lt;code&gt;branch&lt;/code&gt; to force using PRs, or leave blank if the repository is read-only.&lt;/li&gt;
&lt;li&gt;&lt;em&gt;&lt;code&gt;&amp;lt;SYNC_ENABLED&amp;gt;&lt;/code&gt;&lt;/em&gt;: Whether you want to enable automatic synchronization. Allowed values are &lt;code&gt;true&lt;/code&gt; and &lt;code&gt;false&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;&lt;em&gt;&lt;code&gt;&amp;lt;YOUR_SYNC_TARGET&amp;gt;&lt;/code&gt;&lt;/em&gt;: Where you want to place your provisioned resources. Git Sync supports two sync targets: &lt;code&gt;folder&lt;/code&gt; (default) creates a folder named after the repository and places synced resources inside it, while &lt;code&gt;folderless&lt;/code&gt; places synced resources at the top level without creating a wrapper folder. Refer to 
    &lt;a href=&#34;/docs/grafana/v13.3/as-code/git-sync/key-concepts/#sync-targets&#34;&gt;Sync targets&lt;/a&gt; for details.&lt;/li&gt;
&lt;li&gt;&lt;em&gt;&lt;code&gt;&amp;lt;SYNC_INTERVAL&amp;gt;&lt;/code&gt;&lt;/em&gt;: How often your Grafana instance automatically pulls updates from the folder managed with Git Sync. The default value is &lt;code&gt;300&lt;/code&gt; seconds in Grafana Cloud, and &lt;code&gt;60&lt;/code&gt; seconds in Grafana OSS/Enterprise.&lt;/li&gt;
&lt;li&gt;&lt;em&gt;&lt;code&gt;&amp;lt;YOUR_GITHUB_REPO_URL&amp;gt;&lt;/code&gt;&lt;/em&gt;: The repository you want to synchronize using Git Sync. For example, &lt;code&gt;https://github.com/example/grafana-dashboards&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;&lt;em&gt;&lt;code&gt;&amp;lt;SYNC_BRANCH&amp;gt;&lt;/code&gt;&lt;/em&gt;: The branch where you want to perform the sync. For example, &lt;code&gt;main&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;For more details and examples such as a GitHub repository via GitHub App Connection or a GitLab/Bitbucket repository with a token authentication, 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;/p&gt;
]]></content><description>&lt;h1 id="set-up-git-sync-with-terraform">Set up Git Sync with Terraform&lt;/h1>
&lt;p>You can configure Git Sync via the Grafana provisioning app platform using Terraform.&lt;/p>
&lt;p>To do so, follow these steps:&lt;/p></description></item><item><title>Instantaneous pulling and dashboard previews</title><link>https://grafana.com/docs/grafana/v13.3/as-code/git-sync/git-sync-setup/set-up-extend/</link><pubDate>Wed, 28 Oct 2026 09:22:36 +0000</pubDate><guid>https://grafana.com/docs/grafana/v13.3/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;p&gt;After 
    &lt;a href=&#34;/docs/grafana/v13.3/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;ul&gt;
&lt;li&gt;Use port forwarding and DNS, &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;/li&gt;
&lt;li&gt;After you have the public URL, add it to your Grafana configuration file:

&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;/li&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;webhook-limits&#34;&gt;Webhook limits&lt;/h3&gt;
&lt;p&gt;Git Sync registers its own webhooks for each repository connection, so when several Grafana instances sync the same repository, each connection adds to this total. Since &lt;a href=&#34;#webhook-limitations-per-provider&#34;&gt;Git providers limit the amount of webhooks&lt;/a&gt; you can set for each repository, when the limit is exceeded, your Git provider rejects new webhooks.&lt;/p&gt;
&lt;p&gt;For example, in GitHub you can get an error such as:&lt;/p&gt;

&lt;div class=&#34;code-snippet code-snippet__mini&#34;&gt;&lt;div class=&#34;lang-toolbar__mini&#34;&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&gt;&lt;div class=&#34;code-snippet code-snippet__border&#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-none&#34;&gt;GitHub API error (HTTP 422: Validation Failed: The &amp;#34;pull_request&amp;#34; event cannot have more than 20 hooks; The &amp;#34;push&amp;#34; event cannot have more than 20 hooks)&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;If you hit this limit, you can either:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Remove unused or duplicate webhooks from your repository&amp;rsquo;s &lt;strong&gt;Settings &amp;gt; Webhooks&lt;/strong&gt; page.&lt;/li&gt;
&lt;li&gt;Disable webhook integration for connections that don&amp;rsquo;t need real-time sync so those instances poll on an interval instead. Refer to 
    &lt;a href=&#34;/docs/grafana/v13.3/as-code/git-sync/git-sync-setup/#webhook-options&#34;&gt;Webhook options&lt;/a&gt; to disable webhook integration.&lt;/li&gt;
&lt;/ul&gt;
&lt;h4 id=&#34;webhook-limitations-per-provider&#34;&gt;Webhook limitations per provider&lt;/h4&gt;
&lt;p&gt;The following limits apply:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;GitHub limits each repository to 20 webhooks per event type, such &lt;code&gt;push&lt;/code&gt; and &lt;code&gt;pull_request&lt;/code&gt;. For more information refer to the official &lt;a href=&#34;https://docs.github.com/en/webhooks/types-of-webhooks&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;GitHub webhooks documentation&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;GitLab defaults to 100 webhooks for each project, 50 for each group, although subgroup webhooks are not counted towards parent group limits. Refer to &lt;a href=&#34;https://docs.gitlab.com/user/gitlab_com/#other-limits&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;GitLab settings&lt;/a&gt; for more information.&lt;/li&gt;
&lt;li&gt;BitBucket limits to 50 webhooks per repository. Refer to &lt;a href=&#34;https://support.atlassian.com/bitbucket-cloud/docs/manage-webhooks/#Create-webhooks&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;BitBucket webhook documentation&lt;/a&gt; for more details.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;set-a-publicly-reachable-url&#34;&gt;Set a publicly-reachable URL&lt;/h3&gt;
&lt;p&gt;If you need to point &lt;code&gt;[server] root_url&lt;/code&gt; to an internal address (for example, when Grafana runs behind a private ingress in a Kubernetes cluster), set the publicly-reachable URL with &lt;code&gt;[provisioning] public_root_url&lt;/code&gt; instead. This URL is used both to register webhook callbacks with the Git provider and as the base for screenshot images embedded in pull-request comments, which the Git provider&amp;rsquo;s servers fetch from the public internet.&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;[server]
root_url = http://internal.cluster.local

[provisioning]
public_root_url = https://&amp;lt;PUBLIC_DOMAIN&amp;gt;&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;The per-repository &lt;code&gt;spec.webhook.baseUrl&lt;/code&gt; field still overrides &lt;code&gt;public_root_url&lt;/code&gt; for webhook registration, and screenshot URLs always use &lt;code&gt;public_root_url&lt;/code&gt; (or &lt;code&gt;root_url&lt;/code&gt; when unset).&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 Git provider&amp;rsquo;s IP addresses, or expose only the necessary paths.&lt;/p&gt;
&lt;p&gt;For information about the traffic between Grafana and your Git server, refer to 
    &lt;a href=&#34;/docs/grafana/v13.3/as-code/git-sync/git-sync-setup/set-up-before/#network-connectivity-and-ip-allowlisting&#34;&gt;Network connectivity and IP allowlisting&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;In RegExp, the necessary paths required to be exposed are &lt;code&gt;/apis/provisioning\.grafana\.app/v0(alpha1)?/namespaces/[^/]&#43;/repositories/[^/]&#43;/(webhook|render/.*)$&lt;/code&gt;.&lt;/p&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;Available in Grafana OSS and Grafana Enterprise only.&lt;/p&gt;&lt;/blockquote&gt;&lt;/div&gt;

&lt;p&gt;To set up image rendering to add visual previews of dashboard updates directly in pull requests, &lt;strong&gt;install the Grafana Image Renderer&lt;/strong&gt; 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;p&gt;Image rendering requires webhooks.&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/v13.3/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/v13.3/as-code/git-sync/add-resources/&#34;&gt;Export resources&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;
    &lt;a href=&#34;/docs/grafana/v13.3/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/v13.3/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/v13.3/as-code/git-sync/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;p>After
&lt;a href="/docs/grafana/v13.3/as-code/git-sync/git-sync-setup/">setup&lt;/a>, you can optionally extend Git Sync by enabling pull request notifications and image previews of dashboard changes.&lt;/p></description></item></channel></rss>