CREATE GIT REPOSITORY

statementsupportedContainer services & dev tooling

docs.snowflake.com ↗

Object: GIT REPOSITORY

Creates a Snowflake Git repository clone in the schema or replaces an existing Git repository clone. A Git repository clone is read-only. Snowflake objects and code, such as stored procedures, UDFs, and tasks, can reference files in the clone. They use the version of each file from the most recent fetch. For an overview, see Using a Git repository in Snowflake. Tip To create and edit files, manage branches, and commit and push changes from Snowsight, Snowflake recommends Git workspaces instead of a Git repository clone.

Syntax

supportedpartialnot supportednot scored

CREATE [ OR REPLACE ] GIT REPOSITORY [ IF NOT EXISTS ] <name>
  ORIGIN = '<repository_url>'
  API_INTEGRATION = <integration_name>
  [ GIT_CREDENTIALS = <secret_name> ]
  [ COMMENT = '<string_literal>' ]
  [ [ WITH ] TAG ( <tag_name> = '<tag_value>' [ , <tag_name> = '<tag_value>' , ... ] ) ]

Parameters

NameRequiredDescription
namerequiredSpecifies the identifier for the Git repository clone to create. If the identifier contains spaces or special characters, the entire string must be enclosed in double quotes. Identifiers enclosed in double quotes are also case-sensitive. For more information, see Identifier requirements.
ORIGIN = 'repository_url'requiredSpecifies the origin URL of the remote Git repository that this Git repository clone represents. The URL must use HTTPS. Snowflake supports any HTTPS Git repository URL. For example, you can specify a custom URL to a corporate Git server within your own domain. From the command line, you can use the git config command from within your local repository to get the value to use for the ORIGIN parameter, as shown in the following example:Copy code $ git config --get remote.origin.url https://github.com/mycompany/My-Repo.git
API_INTEGRATION = integration_namerequiredSpecifies the API INTEGRATION that contains information about the remote Git repository such as allowed credentials and prefixes for target URLs. The API integration you specify here must have an API_PROVIDER parameter whose value is set to git_https_api. For reference information about API integrations, see CREATE API INTEGRATION.
GIT_CREDENTIALS = secret_nameoptionalSpecifies the Snowflake secret containing the credentials to use for authenticating with the remote Git repository. Omit this parameter to use the default secret specified by the API integration or if this integration does not require authentication. As a best practice, use a personal access token for the secret’s PASSWORD value. For information about creating a personal access token in GitHub, see Managing your personal access tokens in the GitHub documentation. The secret you specify here must be a secret specified by the ALLOWED_AUTHENTICATION_SECRETS parameter of the API integration you specify with this command’s API_INTEGRATION parameter. Default: No value For reference information about secrets, see CREATE SECRET.
COMMENT = 'string_literal'optionalSpecifies a comment for the Git repository clone. Default: No value
TAG ( tag_name = 'tag_value' [ , tag_name = 'tag_value' , ... ] )optionalSpecifies the tag name and the tag string value. The tag value is always a string, and the maximum number of characters for the tag value is 256. For information about specifying tags in a statement, see Tag quotas.

Usage notes

Access control requirements

A role used to execute this operation must have the following privileges at a minimum: Privilege | Object | Notes CREATE GIT REPOSITORY | Schema | USAGE | API integration | The integration specified by this command’s API INTEGRATION parameter USAGE | Secret | The secret specified by this command’s GIT_CREDENTIALS parameter Operating on an object in a schema requires at least one privilege on the parent database and at least one privilege on the parent schema. For instructions on creating a custom role with a specified set of privileges, see Creating custom roles. For general information about roles and privilege grants for performing SQL actions on securable objects, see Overview of Access Control.

See also

Referenced by