Repos CLI
Note
The Repos CLI requires Databricks CLI 0.15.0 or above.
You run Databricks repos CLI subcommands by appending them todatabricksrepos
. These subcommands call theRepos API 2.0.
For more information about repos, seeGit integration with Databricks Repos.
databricks repos --help
Usage: databricks repos [OPTIONS] COMMAND [ARGS]... Utility to interact with the repos API. Options: -v, --version [VERSION] --debug Debug mode. Shows full stack trace on error. --profile TEXT CLI connection profile to use. The default profile is "DEFAULT". -h, --help Show this message and exit. Commands: create Creates a repo. delete Deletes a repo. get Lists information about a repo. list Lists all available repos in the workspace. update Updates information about a repo.
Create a repo
To display usage documentation, rundatabricksreposcreate--help
.
Usage
databricks repos create --url --provider --path
Replace:
with the required Git provider’s URL to the repo.
with the required Git provider’s name, for examplegitHub
. Available providers include:azureDevOpsServices
bitbucketCloud
bitbucketServer
gitHub
gitHubEnterprise
gitLab
gitLabEnterpriseEdition
The provider’s name can be specified as case-insensitive (for example,
gitHub
andgithub
are both valid).
with an optional path to the repo in the Databricks workspace, for example/Repos/someone@example.com/my-repo
.
List all available repos in the workspace
To display usage documentation, rundatabricksreposlist--help
.
Usage
databricks repos list --path-prefix --next-page-token
Replace:
with an optional path prefix to the repos in the Databricks workspace, for example/Repos/someone@example.com/my-repo
.
with an optional next page token provided by running the command previously, to get the next page of results.
Example output
{"repos": [{"id": 1234567890123456,"path": "/Repos/someone@example.com/my-repo","url": "https://github.com/my/my-repo","provider": "gitHub","branch": "master","head_commit_id": "9837ac1f924a5ca56117597c5c79bb02300ff1f4"},{"id": 2345678901234567,"path": "/Repos/someone@example.com/my-repo-2","url": "https://github.com/my/my-repo-2","provider": "gitHub","branch": "master","head_commit_id": "837ac1f924a5ca56117597c5c79bb02300ff1f4a"}]}
List information about a repo
To display usage documentation, rundatabricksreposget--help
.
Update a repo to the most recent commit of a remote branch or to a tag
To display usage documentation, rundatabricksreposupdate--help
.
Usage
databricks repos update --repo-id --branch
Or:
databricks repos update --repo-id --tag
Or:
databricks repos update --path --branch
Or:
databricks repos update --path --tag
Exactly one of--repo-id
or--path
is required, and exactly one of--branch
or--tag
is required.
--repo-id
or--path
identifies the Databricks Repo that should be updated.--branch
or--tag
identifies the commit to update to or the new branch to check out. If--branch
or--tag
refers to the branch that is currently checked out, Databricks Repos performs a pull operation to update to the latest commit for that branch. If--branch
or--tag
refers to a branch not currently checked out, Databricks Repos checks out the specified branch.
Replace:
with the ID of the repo, for example1234567890123456
. To get the ID, run thelistcommand.
with the path to the repo in the Databricks workspace, for example/Repos/someone@example.com/my-repo
. To get the path, run thegetorlistcommand.
with the name of the branch in the repo to use, for examplemy-branch
.
with the name of the branch in the repo to use, for examplemy-tag
.
Delete a repo
To display usage documentation, rundatabricksreposdelete--help
.
Usage
databricks repos delete --repo-id
Or:
databricks repos delete --path
Replace:
with the ID of the repo, for example1234567890123456
. To get the ID, run thelistcommand.--repo-id
or--path
is required.
with the path to the repo in the Databricks workspace, for example/Repos/someone@example.com/my-repo
. To get the path, run thegetorlistcommand.--repo-id
or--path
is required.
If successful, no output is displayed.