Skip to main content

How can I use Git from the Databricks SSH tunnel?

Summary

  • Inside a Databricks SSH tunnel session you can run the standard Git CLI against Git folders that have Git CLI access, using the Git credentials you've already configured in the workspace.
  • Both pieces are pre-GA. The SSH tunnel is in Beta, and Git CLI support for Git folders is in Public Preview, which workspace admins control from the Previews page.
  • The docs scope this to newly created Git folders. Create one from the UI, where it gets Git CLI access when the workspace is eligible, or run git clone in the web terminal.
  • If Git prompts for credentials, connect your Git provider under Settings > Linked accounts. If you hold several credentials for one provider, set DB_GIT_CREDENTIAL_NAME to pick one.
  • Keep repositories under /Workspace. Files there persist across cluster restarts, while the session's default directory and local paths such as /home are ephemeral.

How can I use Git from the Databricks SSH tunnel?

Connect with the SSH tunnel, change into a Git folder under /Workspace that has Git CLI access, and run Git as you would locally: git status, git commit, git push, git rebase -i. Databricks supplies the Git credentials you configured in the workspace, so you don't paste tokens into the remote shell. Both features are pre-GA (the SSH tunnel is in Beta and Git CLI support for Git folders is in Public Preview), so check that your admin has enabled the preview before you plan a team workflow around it.

What Git CLI access gives you

A standard Git folder handles common operations through the Git dialog. A Git folder with Git CLI access runs real Git:

Capability What it means in practice
Any Git command Including git stash, git push --force and git rebase -i
Pre-commit hooks Run linting and code scanning before each commit
Larger repositories Work with repositories that exceed the memory and disk limits of standard Git folders
Submodules and LFS Use Git submodules and Large File Storage
Local commit history Stage multiple commits locally before pushing to the remote

The Git folders docs name the SSH tunnel directly: running Git CLI commands from an IDE or terminal connected over an SSH tunnel "meets the compute requirement for Git CLI commands in the terminal."

Step by step

  1. Connect your Git provider. In the workspace, click your username, select Settings, then Linked accounts > Add Git credential. Some providers offer OAuth linking; others need a personal access token.
  2. Confirm the preview is on. A workspace admin enables Git CLI support for Git folders from the Previews page.
  3. Create a Git folder with Git CLI access. From the UI (Create > Git folder), Databricks enables Git CLI access automatically when the preview is on, serverless compute is available, Databricks can reach your Git provider from serverless compute, and the repository is within the preview's file-count limit. Or open the web terminal, cd into your user folder under /Workspace, and run git clone <remote-url>. Folders cloned there always get Git CLI access.
  4. Open the tunnel. Run databricks ssh connect --ide vscode, use --ide cursor, or omit the flag for a terminal. For a dedicated cluster, use the host entry you created with databricks ssh setup.
  5. Work in the repo. The session starts in an ephemeral directory, so cd into the repository under /Workspace/Users/<your-username>/ and use Git normally:
git rebase -i main
git stash
git submodule update --init --recursive

How credentials work

Git CLI operations use your stored workspace Git credentials automatically. Databricks infers the provider from the remote URL and uses your default credential for that provider. If it can't settle on a single credential, it prompts you; set the DB_GIT_CREDENTIAL_NAME environment variable to the credential's name to skip the prompt. Databricks then remembers which credential you used for that repository. If the Git CLI asks for credentials at all, the SSH tunnel docs say you need to connect your Git provider to Databricks.

What to check before you rely on it

  • Persistence. Files in /Workspace, /Volumes and /dbfs survive cluster restarts. Anything stored in /home, /root or the default session directory is lost on restart.
  • Governance. Git URL allowlists apply to Git operations run from the Databricks UI, but they aren't enforced for commands run directly with the Git CLI. Git folders with Git CLI access also aren't returned by the List Repos API.
  • Permissions. For permission errors, the docs say to verify CAN MANAGE on the parent folder and a valid workspace Git credential.
  • Network. If your Git provider requires private network connectivity, configure it so serverless compute can reach the provider.

Where this fits in a delivery workflow

Git in the tunnel is for interactive development: branch, commit, rebase and push from your own editor while code runs on Databricks compute. For CI/CD and production deployments, the Git folders setup docs say to use Declarative Automation Bundles with versioned artifacts and workload identity federation. Push your branch, open a pull request with your Git provider, and let CI deploy the bundle.
See Use Git in an SSH session and Use Git CLI commands.

FAQs

Which credentials does Git use inside the SSH tunnel?

The Git credentials configured in your Databricks workspace. Databricks picks your default credential for the provider it infers from the remote URL.

Can I use the Git CLI in any Git folder?

No. The SSH tunnel docs scope it to newly created Git folders with Git CLI access. A standard Git folder still supports Git operations from the Git folders UI.

Is Git in the SSH tunnel generally available?

No. The SSH tunnel is in Beta, and Git CLI support for Git folders is in Public Preview.

Will my uncommitted changes survive a cluster restart?

Yes, if the repository lives under /Workspace. Files in /Workspace, /Volumes and /dbfs persist across cluster restarts.

The information provided herein is for general informational purposes only and may not reflect the most current product capabilities or configurations.