Skip to main content

git_credentials

Creates, updates, deletes, gets or lists a git_credentials resource.

Overview​

Namegit_credentials
TypeResource
Iddatabricks_workspace.workspace.git_credentials

Fields​

The following fields are returned by SELECT queries:

NameDatatypeDescription
namestringthe name of the git credential, used for identification and ease of lookup
credential_idinteger
git_emailstringThe authenticating email associated with your Git provider user account. Used for authentication with the remote repository and also sets the author & committer identity for commits. Required for most Git providers except AWS CodeCommit. Learn more at https://docs.databricks.com/aws/en/repos/get-access-tokens-from-git-provider
git_providerstringThe Git provider associated with the credential.
git_usernamestringThe username provided with your Git provider account and associated with the credential. For most Git providers it is only used to set the Git committer & author names for commits, however it may be required for authentication depending on your Git provider / token requirements. Required for AWS CodeCommit.
is_default_for_providerbooleanif the credential is the default for the given provider

Methods​

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
getselectcredential_id, deployment_nameprincipal_idGets the Git credential with the specified credential ID.
listselectdeployment_nameprincipal_idLists the calling user's Git credentials.
createinsertdeployment_name, git_providerCreates a Git credential entry for the user. Use the PATCH endpoint to update existing credentials, or
updateupdatecredential_id, deployment_name, git_providerUpdates the specified Git credential.
deletedeletecredential_id, deployment_nameprincipal_idDeletes the specified Git credential.

Parameters​

Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.

NameDatatypeDescription
credential_idintegerThe ID for the corresponding credential to access.
deployment_namestringThe Databricks Workspace Deployment Name (default: dbc-abcd0123-a1bc)
principal_idintegerThe ID of the service principal whose credentials will be modified. Only service principal managers can perform this action.

SELECT examples​

Gets the Git credential with the specified credential ID.

SELECT
name,
credential_id,
git_email,
git_provider,
git_username,
is_default_for_provider
FROM databricks_workspace.workspace.git_credentials
WHERE credential_id = '{{ credential_id }}' -- required
AND deployment_name = '{{ deployment_name }}' -- required
AND principal_id = '{{ principal_id }}'
;

INSERT examples​

Creates a Git credential entry for the user. Use the PATCH endpoint to update existing credentials, or

INSERT INTO databricks_workspace.workspace.git_credentials (
git_provider,
git_email,
git_username,
is_default_for_provider,
name,
personal_access_token,
principal_id,
deployment_name
)
SELECT
'{{ git_provider }}' /* required */,
'{{ git_email }}',
'{{ git_username }}',
{{ is_default_for_provider }},
'{{ name }}',
'{{ personal_access_token }}',
{{ principal_id }},
'{{ deployment_name }}'
RETURNING
name,
credential_id,
git_email,
git_provider,
git_username,
is_default_for_provider
;

UPDATE examples​

Updates the specified Git credential.

UPDATE databricks_workspace.workspace.git_credentials
SET
git_provider = '{{ git_provider }}',
git_email = '{{ git_email }}',
git_username = '{{ git_username }}',
is_default_for_provider = {{ is_default_for_provider }},
name = '{{ name }}',
personal_access_token = '{{ personal_access_token }}',
principal_id = {{ principal_id }}
WHERE
credential_id = '{{ credential_id }}' --required
AND deployment_name = '{{ deployment_name }}' --required
AND git_provider = '{{ git_provider }}' --required;

DELETE examples​

Deletes the specified Git credential.

DELETE FROM databricks_workspace.workspace.git_credentials
WHERE credential_id = '{{ credential_id }}' --required
AND deployment_name = '{{ deployment_name }}' --required
AND principal_id = '{{ principal_id }}'
;