Databricks DE · Topic 11.2
A visual Git client + API inside the workspace — clone, branch, commit, pull, push your notebooks & code. The source-control foundation for code review and CI/CD.
databricks.yml.▸ clone → branch → commit → push → PR
Mechanism: Databricks needs credentials to act for you. Hosted GitHub → the Databricks GitHub app (OAuth 2.0) (auto-renews, repo-scoped); others → a PAT. Trade-off: PATs expire/rotate; the GitHub app needs a one-time admin install.
# Register a PAT credential (git-credentials group). # Providers: gitHub, gitLab, azureDevOpsServices, bitbucketCloud, awsCodeCommit, … databricks git-credentials create gitHub \ --git-provider gitHub \ --git-username my-user \ --personal-access-token "$GIT_PAT" # Hosted GitHub: prefer the Databricks GitHub app / OAuth over a PAT.
Mechanism: clone a remote into a Git folder, then branch/commit/pull/push & resolve conflicts in the Git dialog; the repos API/CLI does the same for automation. Trade-off: the UI client is for dev — prod deploys from a clean pinned ref via DABs.
# Programmatic clone (CI/automation) — databricks repos command group: databricks repos create \ --url https://github.com/acme/sales-platform \ --provider gitHub \ --path /Workspace/Repos/ci/sales-platform # Day-to-day dev uses the workspace Git dialog (branch/commit/push).
Mechanism: isolate each change on a feature branch, push, open a PR for review; merge to main triggers CI. Notebooks are stored as source files, so diffs are reviewable. Trade-off: notebook outputs aren't versioned (only source); mind notebook merge conflicts.
# git flow that maps to the UI buttons: git checkout -b feature/add-returns-metric git add src/ resources/ databricks.yml git commit -m "Add net-returns metric to sales pipeline" git push -u origin feature/add-returns-metric # → open a PR; review; merge to main triggers CI.
Mechanism: the repo holds source + databricks.yml. On PR, CI runs bundle validate; on merge, CI authenticates as a service principal and runs bundle deploy -t prod. Trade-off: CI must auth without a human — use a service principal + OAuth, never a personal token.
# .github/workflows/deploy.yml — GitHub Action calling the Databricks CLI name: deploy on: push: { branches: [ main ] } pull_request: {} jobs: bundle: runs-on: ubuntu-latest env: DATABRICKS_HOST: ${{ secrets.DATABRICKS_HOST }} DATABRICKS_CLIENT_ID: ${{ secrets.DBX_SP_CLIENT_ID }} # service principal DATABRICKS_CLIENT_SECRET: ${{ secrets.DBX_SP_SECRET }} # OAuth (M2M) steps: - uses: actions/checkout@v4 - uses: databricks/setup-cli@main - run: databricks bundle validate # every PR - if: github.ref == 'refs/heads/main' run: databricks bundle deploy -t prod # on merge
Mechanism: enable sparse checkout (cone patterns) at clone time so only chosen sub-paths sync; admins can allow-list Git URLs/providers workspace-wide. Trade-off: patterns are set at clone & must track repo layout changes.
# Cone sparse-checkout patterns entered in the "Create Git folder" dialog: sales-platform/ docs/ # only these sub-trees sync into the workspace Git folder # admin: also allow-list permitted Git URLs/providers for the workspace.
databricks.yml)| Git folders | Asset Bundles | |
|---|---|---|
| Role | Version-control | Deploy |
| Where | Workspace UI / repos API | CLI / CI |
| Together | Git holds the code → CI runs DABs to deploy it | |
databricks bundle deploy — code → review → prod, versioned.repos/git-credentials APIs.