Sub topic 15
Permissions and limits of Git folders
This chapter assumes you can clone a repository into a Git folder, switch branches, and commit and push from the workspace UI. It also assumes you know basic workspace permissions. Here you will learn who can do what in a Git folder, why Git credentials are separate from workspace permissions, and which limits to plan around.
Two permission systems
Git folder access is controlled by two independent systems:
- Workspace permissions control what a user may do with the Git folder and its contents inside Databricks.
- Git provider permissions control what the user's linked credential may do in the remote repository.
A Git operation succeeds only if both systems allow it. A user with Can Manage on the folder still can't push to a protected branch if their provider account lacks write access. A user with admin rights on GitHub still can't commit from a folder they can only read in the workspace.
Workspace permission levels
A Git folder uses the same permission levels as other workspace objects. The permissions you set on the folder apply to everything inside it.
| Level | What it allows in a Git folder |
|---|---|
| No Permissions | The folder is not visible to the user. |
| Can Read | View notebooks and files. |
| Can Run | Read, and run notebooks on compute the user can attach to. |
| Can Edit | Run and edit contents, and perform Git operations such as commit, push, pull, and branch switches. |
| Can Manage | Everything above, plus changing permissions and deleting the folder. |
Check the current Databricks documentation for the exact minimum level each Git action needs, because the wording differs between workspace editions. The practical rule is that Can Edit and above is for people who change code. Can Run and Can Read are for people who only consume it.
Permissions are inherited from the parent folder. A Git folder created under a user's home folder starts private to that user. A Git folder under a shared folder inherits the sharing of that folder. Decide the parent location before you clone.
Git credentials are per user
Each person links their own Git credential, such as a personal access token or an OAuth connection, in their user settings. This has three consequences:
- Commits and pushes are attributed to the person who made them, and the provider's audit log shows that person.
- The same Git folder can be edited by several workspace users, and each person's push is authorized by their own credential.
- If a person leaves the team and their credential is revoked, only their Git operations stop. The folder and its contents stay.
Don't share one credential across a team to avoid setup. You lose attribution, and you can't revoke one person without revoking everyone. For automation, use a service principal with its own credential.
Credentials for jobs
When a job's task reads its notebook from a Git source, the job runs as an identity, either a user or a service principal. That identity needs a Git credential that can read the repository. If the run-as identity has no credential, the run fails when it tries to fetch the code, even though the job was created successfully. Set up the credential for the service principal before you schedule the job.
Administrator controls
Workspace admins can restrict Git use. Two common controls:
- An allow list of repository URLs limits which remotes users may clone, commit to, or push to. If a clone fails with a policy error, check this list first.
- Admins can turn Git folders off or limit them to certain operations, depending on the workspace configuration.
Ask your admin which controls are on before you build a team workflow around Git folders.
Operational limits
Git folders are a working copy inside the workspace, not a full Git installation. The limits fall into three groups: size, supported Git features, and behavior.
Size and count
Databricks documents limits on the size of the working branch, the size of single files, and the number of files and Git folders. They have changed between releases, so treat any number you read in a tutorial as provisional and check the current limits page. In general:
- The working branch is capped at a size on the order of 1 GB.
- Very large files can't be viewed or edited in the workspace UI.
- A workspace can hold only a limited number of Git folders.
Don't commit data files, model binaries, or build output. Keep data in cloud storage or Unity Catalog volumes, and keep only code and small configuration in the repository.
The script below walks a local clone and reports the total size and the largest files. Run it before you push a repository you plan to clone into Databricks.
import os
import sys
root = sys.argv[1] if len(sys.argv) > 1 else "."
sizes = []
for dirpath, dirnames, filenames in os.walk(root):
if ".git" in dirnames:
dirnames.remove(".git") # skip Git's internal storage
for name in filenames:
path = os.path.join(dirpath, name)
try:
sizes.append((os.path.getsize(path), path))
except OSError:
pass # broken symlink or file removed during the scan
total_mb = sum(s for s, _ in sizes) / 1_000_000
print(f"{len(sizes)} files, {total_mb:.1f} MB (excluding .git)")
for size, path in sorted(sizes, reverse=True)[:5]:
print(f"{size / 1_000_000:8.1f} MB {path}")Run it as python check_size.py path/to/clone. The script excludes .git, so compare the result with the size limit for the working branch, which the workspace checks after checkout.
Git features
Git folders implement the common workflow: clone, branch, commit, push, pull, merge, and conflict resolution. They do not expose every Git feature. Features that may be missing or limited include submodules, stashing, and some history-rewriting operations. If your process depends on one of them, do that step in a local clone or in your provider's web interface, then pull the result into the Git folder.
Behavior to remember
- Revision history: notebooks in a Git folder are versioned by Git. Use the commit history in your provider rather than the notebook revision panel.
- Uncommitted changes are not protected: edits exist only in the workspace until you commit and push. If someone deletes the folder, uncommitted work is lost.
- One working branch per folder: a folder shows one checked-out branch. If two people edit the same Git folder, they share that branch. Give each developer their own Git folder.
- Files outside the repo: don't store scratch notebooks inside a shared Git folder. They show up as uncommitted changes for everyone.
A permission layout that works
| Folder | Who has access | Purpose |
|---|---|---|
| Personal Git folder under each user's home | The owner only | Feature branch development |
| Shared staging Git folder | Team: Can Run. Leads: Can Edit | Testing merged code |
| Production Git folder or Git-source job | Service principal: Can Manage. Others: Can Read | Scheduled runs of reviewed code |
For production, a job whose tasks read from a Git source removes the need for a production Git folder. The job fetches a named branch or tag at run time, so nobody can edit what runs.
Troubleshooting
| Symptom | Likely cause |
|---|---|
| Push button is disabled or fails with a permission error | Workspace permission is below Can Edit, or the credential lacks write access on the provider. |
| Authentication failed on pull | The personal access token expired or was revoked. Relink it in user settings. |
| Clone rejected by policy | The repository URL is not on the admin allow list. |
| Scheduled job fails before running code | The run-as identity has no Git credential, or the credential can't read the repository. |
| Checkout fails or the folder is incomplete | The branch exceeds a size or file limit. Remove large files from the repository. |
Exercise
A developer has Can Manage on a Git folder, but pushing a feature branch fails with a 403 from the provider. Which permission system is blocking the push, and what do you check?
Show answer
The Git provider's permissions are blocking it, not the workspace. Can Manage already allows Git operations in the workspace. Check that the developer's own linked credential is valid and has write access to the repository, and whether the target branch is protected. A shared or expired token is a common cause.
Exercise
A nightly job with a Git-source notebook task works when you trigger it manually but fails on schedule with an authentication error. The schedule runs as a service principal. What is the likely cause?
Show answer
The service principal has no Git credential, or its credential can't read the repository. Your manual run used your own credential. Link a credential for the service principal, or switch the job's run-as identity to one that has one.