Sub topic 15
Sharing Work and Using Git Folders
This chapter assumes you can run a notebook on attached compute and know what a workspace is. It covers how to share notebooks with teammates and how to keep them under version control with Git folders.
Sharing inside the workspace
Every notebook, folder, and job in a workspace has an access control list (ACL). An ACL lists who can do what with the object. The common permission levels for a notebook are:
| Level | What it allows |
|---|---|
| Can Read | View the notebook and its results |
| Can Run | Read, plus attach to compute and run cells |
| Can Edit | Run, plus change the code |
| Can Manage | Edit, plus change permissions and delete |
Permissions on a folder are inherited by the items inside it. Put shared work in a shared folder and grant a group access, not individual users.
Notebook permissions control the code, not the data. A teammate who can edit your notebook still needs Unity Catalog privileges such as SELECT to read main.tutorial.orders. Sharing a notebook never grants data access.
Why use Git folders
Workspace notebooks have revision history, but it is limited. It does not give you branches, pull requests, or code review. A Git folder (formerly called Repos) is a workspace folder that is linked to a remote Git repository, such as one on GitHub, GitLab, Azure DevOps, or Bitbucket. The repository remains the source of truth. The Git folder is a working copy.
You can create one from the workspace UI by choosing Create, then Git folder, and pasting the repository URL. You also need a Git credential saved in your user settings, usually a personal access token.
The everyday workflow
- Create or open your Git folder and pull the latest changes.
- Create a feature branch from the Git menu. Avoid committing directly to
main. - Edit notebooks and files, and run them on your compute.
- Commit with a clear message and push.
- Open a pull request in your Git provider. After review, merge it.
A Git folder can hold more than notebooks. It can also hold Python modules, SQL files, and configuration, so you can import shared code from .py files next to your notebooks.
Git folders and jobs
A job can run a notebook directly from a remote Git repository, pinned to a branch, tag, or commit. This makes scheduled runs reproducible. Pinning to a tag or commit means an unreviewed edit cannot change production behavior.
Common errors
- Authentication failures on push or pull. The personal access token has expired or lacks repository scope. Generate a new one and update it in your user settings.
- Merge conflicts. Two people edited the same cell. Resolve the conflict in the Git folder or in your Git provider, then commit.
- Edits made in a teammate's Git folder. Each person works in their own Git folder. Editing someone else's copy leads to confusing branch state.
- Notebook outputs in diffs. Cell results can add noise. Keep outputs out of commits where your workspace settings allow it.
Exercise
A teammate has Can Edit on your notebook, which queries main.tutorial.orders. When they run it, they get a permission error on the table. Why, and what fixes it?
Show answer
Notebook permissions do not grant data access. Unity Catalog checks the teammate's own privileges. Grant their group USE CATALOG on main, and USE SCHEMA and SELECT on main.tutorial.
Exercise
Why would you pin a production job to a Git tag instead of the main branch?
Show answer
A tag always points to the same commit, so the job runs the same reviewed code each time. A branch changes whenever someone merges, which can alter production behavior without warning.