Developing notebooks in Databricks is convenient because everything happens in the browser, but team collaboration and version control require Git integration.Databricks Repos lets you clone a Git repository directly inside the workspace and switch branches, Pull, Push, and view diffs from the UI.
This article covers what Repos is, supported Git providers, branching design, file format choices (.py vs .ipynb), secrets-management caveats, and integration patterns with CI/CD.
Repos is a clone of a Git repository that appears as a folder inside the Databricks workspace. You do not need to install Git locally — branching, Pull, and Push all happen through the workspace UI.
The main characteristics of Repos are:
| Git provider | Support status | Authentication |
|---|---|---|
| GitHub / GitHub Enterprise | Fully supported | PAT / GitHub App / OAuth |
| GitLab / GitLab Self-Managed | Fully supported | PAT |
| Azure DevOps (Azure Repos) | Fully supported | PAT / Entra ID Token |
| Bitbucket Cloud / Server | Fully supported | App Password / PAT |
| AWS CodeCommit | Supported | Git Credentials (IAM-generated) |
Configure Git credentials under workspace User Settings → Git Integration. Credentials are stored per user and cannot be viewed by other users in the workspace.
For team development with Databricks Repos, we recommend the following branching strategy.
| Branch | Purpose | Protection rules |
|---|---|---|
| main | Code targeted for production deployment | Direct pushes disabled, PR merges only |
| develop | Integration branch for the next release | PR merges only, CI required |
| feature/* | Individual development branches | No restrictions (push freely) |
| release/* | Final validation before release | PR merges only, E2E tests required |
| hotfix/* | Emergency fixes | Branch from main and merge into both main and develop |
A typical development flow looks like this:
feature/add-etl-pipeline branch in ReposThe file format that Databricks Repos saves to Git directly affects the quality of Git management.
| Aspect | .py (source-file format) | .ipynb (notebook format) |
|---|---|---|
| Git diffs | Easy to read (plain Python code) | Hard to read (JSON metadata and output cells) |
| PR review | Easy (code changes are clear) | Difficult (diffs are noisy) |
| File size | Small (code only) | Large (outputs and images embedded as Base64) |
| Development in the Databricks UI | Develop directly in the notebook UI | Develop directly in the notebook UI |
| External IDE compatibility | High (edit directly in VS Code, etc.) | Jupyter-compatible (works with VS Code + Jupyter extension) |
When you save a Databricks notebook in .py format, cell boundaries are represented by# COMMAND ---------- comments. The Databricks UI parses these comments to recreate the cell layout, so .py format preserves the full notebook UI experience.
# Databricks notebook source
# COMMAND ----------
from pyspark.sql import SparkSession
# COMMAND ----------
df = spark.read.format("delta").load("/mnt/data/sales")
display(df.limit(10))
# COMMAND ----------
# MAGIC %sql
# MAGIC SELECT region, SUM(amount) FROM sales GROUP BY regionNever put secrets in Repos (i.e. in the Git repository). The rules below are non-negotiable.
dbutils.secrets.get(scope, key) retrieves secrets at runtime. Secret Scopes are stored securely in Databricks and never end up in Git.# BAD: Hard-coded secret
storage_key = "AbCdEfGhIjKlMnOp..."
# OK: Fetch from a Secret Scope
storage_key = dbutils.secrets.get(scope="my-scope", key="storage-key")
# OK: Fetch from Spark Config (injected via cluster settings)
storage_key = spark.conf.get("spark.custom.storage_key")The recommended division of labor is "Repos for development, CI/CD for deployment": Repos handles Git integration during development, while a CI/CD pipeline (DABs, GitHub Actions, etc.) handles deployment.
| Phase | Tool | Role |
|---|---|---|
| Development | Databricks Repos | Notebook development, testing, Commit, and Push on a branch |
| Code review | GitHub / GitLab / Azure DevOps | Review and approve Pull Requests |
| Test automation | GitHub Actions / Azure Pipelines | Unit tests with pytest and linter checks |
| Deployment | Databricks Asset Bundles (DABs) | Per-environment deployment of jobs and pipelines |
Databricks offers two places to store files: Repos and Workspace Files.
| Aspect | Repos | Workspace Files |
|---|---|---|
| Git integration | Yes (Clone/Pull/Push/Branch) | None |
| Purpose | Team development and version control | Personal working files and dependency placement |
| File types | Notebooks, Python, SQL, config files | Any file (.csv, .json, requirements.txt, etc.) |
| Relative imports | Supported | Supported |
Security & Governance
問題 1
A data engineering team uses Databricks Repos for collaborative development. One member hard-coded a storage account access key into a notebook and committed and pushed it to Git. What is the best response?
正解: A
A secret committed to Git lives forever in history, so simply replacing it in the next commit is not enough. You must scrub history completely with git filter-branch or BFG Repo Cleaner and rotate (reissue) the leaked key immediately. Going forward, switch to retrieving secrets via a Secret Scope. Restricting access to the Repos folder does not control Git-side access, and .gitignore has no effect on already-committed files.
How should I handle merge conflicts in Databricks Repos?
The Databricks Repos UI includes a simple merge conflict editor, but it is not well suited for complex conflicts. In practice, resolve conflicts in your local IDE or on GitHub/GitLab, push the result, and then Pull from Repos. Repos is primarily a mechanism to sync and view Git branches inside the workspace, so it is safer to handle serious conflict resolution in a full Git client.
Should I use .ipynb or .py files in Repos?
From a Git-management standpoint, .py files are recommended. .ipynb files are JSON and embed output cells and metadata, which makes diffs noisy and PR reviews hard. Even if you author a notebook in the Databricks UI, when saving through Repos you can choose the source-file format (.py/.sql/.scala/.r). For team Git review flows, pick .py — you still keep all the benefits of developing in the notebook UI.
How does Databricks Repos show up on the Databricks certification exams?
Repos appears in the Data Engineer Associate "Development Tools and Workflows" domain and in the Professional "CI/CD and Deployment" domain. Typical questions cover Repos-to-Git integration, branching best practices, how to choose between Repos and DABs, and whether secrets may live in Repos. You are not asked to write Git commands — the focus is on where Repos fits in the Databricks ecosystem and the operational gotchas.
Practice with certification-focused question sets
無料で問題を解いてみるNicheeLab Editorial Team
NicheeLab editorial team focused on data engineering and cloud certification learning. Content is structured around practical study needs and official exam domains.
Databricks Certifications: All 7 Exams, Difficulty & Study Plan (2026)
Complete guide to all 7 Databricks certifications — Data Eng...
Databricks Exam Difficulty Ranking: All 7 Certs Compared (2026)
Every Databricks certification ranked by difficulty, with st...
Databricks Study Guide: Fastest Pass Route & Time Estimates (2026)
How to pass Databricks certifications efficiently. Official ...
Databricks Data Engineer Associate: Complete Guide (2026)
Domain-by-domain breakdown of the Databricks Certified Data ...
Databricks Data Engineer Professional: Complete Guide (2026)
Tactics for the Databricks Certified Data Engineer Professio...