Set up RDE and connect your Metabase to Git

You run Metabase, but it isn't connected to Git yet. Connect it, install RDE, and build your first dashboards with a coding agent.

RDE lets a coding agent build your Metabase dashboards, metrics, and transforms in a development Metabase on your machine, and ship them to production through Git. For the full picture, see Get started with RDE.

A sales overview dashboard built by the RDE agent

Use this guide if you run Metabase and it isn’t connected to Git yet. By the end, your production Metabase will sync with a Git repository, you’ll have a development Metabase on your machine, and the agent will have built a first dashboard that reached production through a pull request.

Before you start

You need:

  • A Metabase Pro or Enterprise plan, which includes Git sync, and admin access to your Metabase. A trial works.
  • A data warehouse your machine can reach, and a database user that can read the tables you build on.
  • A GitHub, GitLab, or Bitbucket account where you can create a private repository and a personal access token.
  • A Mac or Linux machine with Node.js 20.19 or later and Git.
  • Docker or Java 21 or later. On a Mac, Docker Desktop, OrbStack, and colima all work.
  • A coding agent such as OpenCode, Claude Code, Codex, Cursor, Gemini CLI, or Windsurf. This guide uses OpenCode.

Part 1: Connect your Metabase to Git

Connect your production Metabase to Git before you install RDE. Production pushes the first files to the repository, and the development Metabase starts from those files.

Create the repository and tokens

  1. Create a new private repository and initialize it with a README. Metabase can’t connect to a repository that has no commits. This guide uses analytics as the repository name.
  2. Create a personal access token for production that can read and write to the repository. On GitHub, create a fine-grained token for the repository with the Contents: Read and write permission. Production needs write access only for the initial push in this part. After that, you can swap in a token with Contents: Read-only.
  3. Each person who uses RDE creates their own token with Contents: Read and write in Part 2.

Turn on Remote sync

Follow Setting up Remote sync with these settings:

  1. Enter the repository URL and the access token from the previous section.
  2. For Sync mode for this instance, choose Read-write. You switch it to Read-only in the next section.

When you save, Metabase creates the Library if it doesn’t exist and syncs it along with your transforms. The Library appears as Semantic layer in Data Studio. Nothing else in your Metabase syncs to Git.

Push the initial state

  1. Click the grid icon and select Main app.
  2. In the top bar, next to the Metabase logo, click the branch name, main, and select Push changes.
  3. (Optional) Describe your changes, for example “Set up remote sync”.
  4. Click Push changes. Wait for Push complete. This first push includes all of production’s existing transforms.
  5. Go back to Admin > Settings > Remote sync.
  6. In the Sync mode for this instance section, choose Read-only.
  7. In the Branch to sync with section, keep Sync branch on main, and turn on Auto-sync with git. If you created a read-only token, replace the Access Token with it.
  8. Click Save changes. Metabase shows Pulling from Git while it imports from main, then Pull complete.

Production now checks main every five minutes and imports any changes. To import right away, click Pull changes now. Because production is in read-only mode, you can no longer edit the Library or transforms there. They change only through Git.

Part 2: Install RDE and create a development Metabase

Run the wizard

npm install -g @metabase/rde
rde init

rde init installs mb, starts a development Metabase at http://localhost:23000, and creates an admin user for it. The wizard prompts you for the following:

  1. Which coding agents should get the rde and data-app skills? Keep OpenCode, or select the agent you use.
  2. Paste your Metabase license token. Use the same token as production.
  3. Where should Metabase push the content? Choose Hosted remote (GitHub, GitLab, Bitbucket…), not the default local remote.
  4. Repository URL and Access token. Enter the same repository as production, with your own token from Part 1.
  5. Where should the Metabase content repository live? Choose Clone into another directory and enter a path such as ~/analytics. This directory is where you work with your agent.
  6. Your database. Paste a connection string for your data warehouse, then enter a Display name. Use the same name the database has in production, so the files in Git match.

RDE imports everything on main into the development Metabase, including the Library that production pushed.

When the wizard finishes, it prints the URL of your development Metabase and the command that starts your agent. To log in, run rde credentials for the password and rde open to open Metabase in your browser.

Start your agent

Start your coding agent in the repository directory:

cd ~/analytics
opencode

If you use another agent, run its command instead. The rde init summary lists the command for each agent you select.

The first time you start the agent, it asks for permission to run mb and other commands on your machine. Approve them. It then asks a few setup questions. It saves your answers to .scratch/STATE.md and reads them at the start of each session, so you don’t have to answer again. RDE excludes the .scratch/ directory from Git, so you can also use it for your working files.

  • Is this instance production or staging? Answer staging. It’s your development Metabase, and your changes reach production through pull requests.
  • Which Metabase? If mb knows more than one, pick the development Metabase. Use the URL that rde status shows.

Part 3: Build your first dashboards and metrics

Describe what you want in plain language. For example, you can ask for a set of clean tables, a metric, or a dashboard. The agent plans the work, builds it in your development Metabase, and verifies the results. Whenever it reaches a business decision, it stops and asks you to decide. To review what it built, run rde open. Only the Library and transforms sync to Git, so the agent builds there. Dashboards and questions in other collections stay in the development Metabase.

To move the agent’s work into Git and on to production, follow the same four steps every time:

  1. Export. The agent asks for permission before it writes anything to Git. It shows you the changes and the name of the branch, which starts with agent/. When you approve, it exports to that branch. The agent never pushes to main without your confirmation.
  2. Review and merge. Open a pull request and review the YAML files. When you’re ready, merge the pull request and delete the branch.
  3. Wait for production to import. Production imports the change within five minutes. To import right away, click Pull changes now in production’s Admin > Settings > Remote sync.
  4. Return to main. Tell the agent that the pull request is merged. It switches your development Metabase back to main, and you run git checkout main && git pull.

Don’t merge the next pull request until production has imported the previous one. Otherwise, production imports the changes in the wrong order.

Commands

CommandWhat it does
rde statusShows your development Metabase, its databases, and its sync state
rde start / rde stopStarts or stops your development Metabase
rde openOpens your development Metabase in the browser
rde credentialsPrints the login for your development Metabase
rde doctorChecks the setup and says how to fix what’s broken. rde doctor --fix repairs what it can
mb git-sync statusShows the branch and whether there are unexported changes

Troubleshooting

Start with rde doctor. It checks everything from Docker to the license and suggests a fix for each failure.

  • “Cannot connect to uninitialized repository.” The repository has no commits. Add a README.
  • “There are unsaved changes in the Remote Sync collection.” Your development Metabase has work that isn’t exported. Ask the agent to export it to a branch first.
  • “You can’t switch to Read-only as you have unpublished changes.” Production has changes that aren’t pushed. Click the branch name in the top bar and select Push changes, then try again.
  • A database in production shows the status Stubbed. The files in Git use a database name that production doesn’t have, usually because the display name in your development Metabase doesn’t match. In Admin > Databases, open the placeholder and enter the production connection details.
  • New dashboards or metrics don’t appear in production. Production hasn’t imported the changes yet. Click Pull changes now in Admin > Settings > Remote sync, or wait for the next automatic pull.