Databricks

Databricks Repos for Real Work and Certification Prep

2026-03-26
更新: 2026-03-27
NicheeLab Editorial Team

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.

What is Databricks Repos?

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:

  • Create and switch branches, Pull, Push, and view diffs from the workspace UI
  • Notebooks, Python files, SQL files, and more can all be put under Git control
  • Pull Requests are created and reviewed on the Git provider side (not in the Databricks UI)
  • Each user can create multiple Repos folders (you can split per-branch if desired)

Supported Git Providers

Git providerSupport statusAuthentication
GitHub / GitHub EnterpriseFully supportedPAT / GitHub App / OAuth
GitLab / GitLab Self-ManagedFully supportedPAT
Azure DevOps (Azure Repos)Fully supportedPAT / Entra ID Token
Bitbucket Cloud / ServerFully supportedApp Password / PAT
AWS CodeCommitSupportedGit 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.

Branching Best Practices

For team development with Databricks Repos, we recommend the following branching strategy.

BranchPurposeProtection rules
mainCode targeted for production deploymentDirect pushes disabled, PR merges only
developIntegration branch for the next releasePR merges only, CI required
feature/*Individual development branchesNo restrictions (push freely)
release/*Final validation before releasePR merges only, E2E tests required
hotfix/*Emergency fixesBranch from main and merge into both main and develop

A typical development flow looks like this:

  1. A developer creates a feature/add-etl-pipeline branch in Repos
  2. Develop and test code in the notebook UI
  3. Commit and Push from the Repos UI
  4. Open a Pull Request on the Git provider's web UI
  5. Reviewers do the code review while CI runs the tests
  6. After merge, the CI/CD pipeline (DABs, etc.) deploys to production

File Format Choice: .py vs .ipynb

The file format that Databricks Repos saves to Git directly affects the quality of Git management.

Aspect.py (source-file format).ipynb (notebook format)
Git diffsEasy to read (plain Python code)Hard to read (JSON metadata and output cells)
PR reviewEasy (code changes are clear)Difficult (diffs are noisy)
File sizeSmall (code only)Large (outputs and images embedded as Base64)
Development in the Databricks UIDevelop directly in the notebook UIDevelop directly in the notebook UI
External IDE compatibilityHigh (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 region

Secrets Management Caveats

Never put secrets in Repos (i.e. in the Git repository). The rules below are non-negotiable.

  • Never hard-code API keys, passwords, or tokens: they live forever in Git history and leak if the repo becomes public or a team member leaves
  • Use Databricks Secret Scopes: dbutils.secrets.get(scope, key) retrieves secrets at runtime. Secret Scopes are stored securely in Databricks and never end up in Git.
  • Use environment variables: inject secrets via cluster environment variables or Spark Config and reference only the key name from code
  • Use .gitignore: keep config files and local .env files out of Git tracking
# 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")

CI/CD Integration Patterns

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.

PhaseToolRole
DevelopmentDatabricks ReposNotebook development, testing, Commit, and Push on a branch
Code reviewGitHub / GitLab / Azure DevOpsReview and approve Pull Requests
Test automationGitHub Actions / Azure PipelinesUnit tests with pytest and linter checks
DeploymentDatabricks Asset Bundles (DABs)Per-environment deployment of jobs and pipelines

Repos Limitations

  • The repo size limit is 10 GB (consider Git LFS for large datasets or binaries)
  • One Repos folder maps to one Git repository (consider sparse checkout for monorepos)
  • Merge conflict resolution beyond the basics must be done in a Git client
  • Git Submodules are not supported
  • Files in Repos folders are access-controlled via workspace ACLs (separate from Git permissions)

Repos vs Workspace Files

Databricks offers two places to store files: Repos and Workspace Files.

AspectReposWorkspace Files
Git integrationYes (Clone/Pull/Push/Branch)None
PurposeTeam development and version controlPersonal working files and dependency placement
File typesNotebooks, Python, SQL, config filesAny file (.csv, .json, requirements.txt, etc.)
Relative importsSupportedSupported

What the Exam Tests

  • "What feature handles notebook version control?" → Databricks Repos (Git integration)
  • "Can secrets be committed to the Git repository?" → No. Use a Secret Scope
  • "How do you choose between Repos and DABs?" → Repos is for Git integration during development, DABs is for deployment automation
  • "Where do you review PRs?" → On the Git provider's web UI (GitHub/GitLab, etc.)
  • "What's wrong with managing .ipynb in Git?" → It's JSON, so diffs are hard to read and output cells become noise

Check Yourself

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?

  1. Completely remove the secret from Git history, rotate the access key, and from now on retrieve it via dbutils.secrets.get() from a Secret Scope
  2. Replace the access key with an environment variable name in the next commit — leaving it in history is fine
  3. Restricting access to the Repos folder is enough to keep the secret in Git history safe
  4. Add the notebook file to .gitignore so future commits exclude it

正解: 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.

Frequently Asked Questions

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.

Check what you learned with practice questions

Practice with certification-focused question sets

無料で問題を解いてみる
Author

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.


Related articles
Databricks

Databricks Certifications: All 7 Exams, Difficulty & Study Plan (2026)

Complete guide to all 7 Databricks certifications — Data Eng...

Databricks

Databricks Exam Difficulty Ranking: All 7 Certs Compared (2026)

Every Databricks certification ranked by difficulty, with st...

Databricks

Databricks Study Guide: Fastest Pass Route & Time Estimates (2026)

How to pass Databricks certifications efficiently. Official ...

Databricks

Databricks Data Engineer Associate: Complete Guide (2026)

Domain-by-domain breakdown of the Databricks Certified Data ...

Databricks

Databricks Data Engineer Professional: Complete Guide (2026)

Tactics for the Databricks Certified Data Engineer Professio...

Browse all Databricks articles (110)
© 2026 NicheeLab All rights reserved.