Skip to main content

Repo

View as Markdown

RepoInfo object

Git folder (repo) information.

idint64

Id of the git folder (repo) in the Workspace.

Example: 5249608814509279

pathstring

Root path of the git folder (repo) in the Workspace.

Example: /Users/user@company.com/testrepo

urlstring

URL of the remote git repository.

Example: https://github.com/databricks/cli.git

providerstring

Git provider of the remote git repository, e.g. gitHub, azureDevOpsServices, bitbucketServer (Bitbucket Data Center), gitLabEnterpriseEdition (GitLab Self-Managed), or awsCodeCommit.

Example: gitHub

branchstring

Name of the current git branch of the git folder (repo).

Example: main

head_commit_idstring

Current git commit id of the git folder (repo).

Example: 7e0847ede61f07adede22e2bcce6050216489171

sparse_checkoutobject

Sparse checkout config for the git folder (repo).

Show child attributesHide child attributes
patternsarray of string

List of sparse checkout cone patterns, see cone mode handling for details.

Get

GET /api/2.0/repos/{id}

Returns the repo with the given repo ID.

API scopes: workspace

Parameters

idint64path

ID of the Git folder (repo) object in the workspace.

Example: 5249608814509279

Response

idint64

ID of the Git folder (repo) object in the workspace.

Example: 5249608814509279

pathstring

Path of the Git folder (repo) in the workspace.

Example: /Users/user@company.com/testrepo

urlstring

URL of the linked Git repository.

Example: https://github.com/databricks/cli.git

providerstring

Git provider of the linked Git repository, e.g. gitHub, azureDevOpsServices, bitbucketServer (Bitbucket Data Center), gitLabEnterpriseEdition (GitLab Self-Managed), or awsCodeCommit.

Example: gitHub

branchstring

Branch that the local version of the repo is checked out to.

Example: main

head_commit_idstring

SHA-1 hash representing the commit ID of the current HEAD of the repo.

Example: 7e0847ede61f07adede22e2bcce6050216489171

sparse_checkoutobject

Sparse checkout settings for the Git folder (repo).

Show child attributesHide child attributes
patternsarray of string

List of sparse checkout cone patterns, see cone mode handling for details.

git_cli_enabledboolean

Whether the Git CLI is enabled for this Git folder (repo). When true, Git commands can be run directly against this Git folder using the Git CLI.

List

GET /api/2.0/repos

Returns repos that the calling user has Manage permissions on. Use next_page_token to iterate through additional pages.

Deprecated: This operation does not return a complete list of the repos in the workspace, because repos with the Git CLI enabled are not included in its results. Instead, use the Repos and Workspace APIs to find repos and their associated metadata in the workspace.

API scopes: workspace

Parameters

path_prefixstringquery

Filters repos that have paths starting with the given path prefix. If not provided or when provided an effectively empty prefix (/ or /Workspace) Git folders (repos) from /Workspace/Repos will be served.

Example: /Users/user@company.com/main_project

next_page_tokenstringquery

Token used to get the next page of results. If not specified, returns the first page of results as well as a next page token if there are more results.

Example: eyJyZXBvX3RyZWVub2RlX2lkIjo1MjQ5NjA4ODE0NTA5Mjc5fQ==

Response

Returns a list of RepoInfo objects.

Create

POST /api/2.0/repos

Creates a repo in the workspace and links it to the remote Git repo specified. Note that repos created programmatically must be linked to a remote Git repo, unlike repos created in the browser.

API scopes: workspace

Request body

urlstring

URL of the Git repository to be linked.

Example: https://github.com/databricks/cli.git

providerstring

Git provider. This field is case-insensitive. The available Git providers are gitHub, bitbucketCloud, gitLab, azureDevOpsServices (Azure DevOps Services, including Microsoft Entra ID authentication), gitHubEnterprise, bitbucketServer (Bitbucket Data Center), gitLabEnterpriseEdition (GitLab Self-Managed), and awsCodeCommit.

Example: gitHub

pathstring

Desired path for the repo in the workspace. Almost any path in the workspace can be chosen. If repo is created in /Repos, path must be in the format /Repos/{folder}/{repo-name}.

Example: /Users/user@company.com/testrepo

sparse_checkoutobject

If specified, the repo will be created with sparse checkout enabled. You cannot enable/disable sparse checkout after the repo is created.

Show child attributesHide child attributes
patternsarray of string

List of sparse checkout cone patterns, see cone mode handling for details.

git_credential_idint64

Git credential ID to use when cloning the repository. The Git credential must be configured for the current user.

Response

idint64

ID of the Git folder (repo) object in the workspace.

pathstring

Path of the Git folder (repo) in the workspace.

Example: /Users/user@company.com/testrepo

urlstring

URL of the linked Git repository.

Example: https://github.com/databricks/cli.git

providerstring

Git provider of the linked Git repository, e.g. gitHub, azureDevOpsServices, bitbucketServer (Bitbucket Data Center), gitLabEnterpriseEdition (GitLab Self-Managed), or awsCodeCommit.

Example: gitHub

branchstring

Branch that the Git folder (repo) is checked out to.

Example: main

head_commit_idstring

SHA-1 hash representing the commit ID of the current HEAD of the Git folder (repo).

Example: 7e0847ede61f07adede22e2bcce6050216489171

sparse_checkoutobject

Sparse checkout settings for the Git folder (repo).

Show child attributesHide child attributes
patternsarray of string

List of sparse checkout cone patterns, see cone mode handling for details.

Update

PATCH /api/2.0/repos/{id}

Updates the repo to a different branch or tag, or updates the repo to the latest commit on the same branch.

API scopes: workspace

Parameters

idint64path

ID of the Git folder (repo) object in the workspace.

Example: 5249608814509279

Request body

branchstring

Branch that the local version of the repo is checked out to.

Example: main

tagstring

Tag that the local version of the repo is checked out to. Updating the repo to a tag puts the repo in a detached HEAD state. Before committing new changes, you must update the repo to a branch instead of the detached HEAD.

Example: v1.0

sparse_checkoutobject

If specified, update the sparse checkout settings. The update will fail if sparse checkout is not enabled for the repo.

Show child attributesHide child attributes
patternsarray of string

List of sparse checkout cone patterns, see cone mode handling for details.

dangerously_force_discard_allboolean

WARNING: DESTRUCTIVE AND IRREVERSIBLE. If true, permanently deletes ALL uncommitted changes in the Git folder — staged, unstaged, and untracked files — before updating. Lost data CANNOT be recovered.

NEVER use this on Git folders where users author or edit files. This flag is intended ONLY for automated jobs that treat the Git folder as a read-only mirror of a remote branch and need to force-sync it. If any user has uncommitted work in the Git folder, that work will be permanently destroyed without warning.

Local commits that have been made but not yet pushed to the remote are preserved.

git_credential_idint64

Git credential ID to use for this update operation. The Git credential must be configured for the current user.