Connect to a Git repository over a public network¶
You can set up Snowflake to access your Git repository over a public network. If your Git server uses IP-based allowlisting, see Securing ingress of Snowflake requests with egress IP addresses to configure stable egress IPs for Snowflake Git traffic.
To connect to a Git repository over a public network, complete the following steps:
-
Configure an API integration for one of the following authentication methods:
-
Authenticate through an OAuth flow.
Configure an API integration to allow for an OAuth2 flow.
-
Authenticate with a token, such as a personal access token.
Configure a secret containing the username and token to use, then configure an API integration that allows Snowflake to use the secret when authenticating.
-
Configure an API integration with details about the Git repository server.
-
-
Create a Git workspace connected to the repository. In a Git workspace, you can create and edit files, manage branches, pull changes, and commit and push changes to the remote repository.
If Snowflake code such as tasks or stored procedures needs to reference repository files, you can also create a Git repository clone. A Git repository clone is a read-only object that’s owned by a role.
Configure for authenticating with OAuth¶

You can configure Snowflake to authenticate with the remote Git repository using an OAuth2 flow.
The Snowflake GitHub App is a pre-configured OAuth2 application that simplifies authentication. You don’t need to register an OAuth application or a redirect URI.
Note
The Snowflake GitHub App works with github.com, including standard GitHub Enterprise Cloud organizations
hosted there. GitHub Enterprise Cloud with data residency (*.ghe.com) and GitHub Enterprise Server
require OAuth2 instead.
-
Create an API integration that specifies the Snowflake GitHub App:
-
Create a Git workspace as described in Create a Git workspace.
For any repository provider, you can create an API integration that specifies OAuth2 parameters directly. Before you begin, create an OAuth application with your provider and collect the client ID, client secret, authorization endpoint, and token endpoint. For end-to-end, provider-specific instructions, see the quickstarts for GitLab, Azure DevOps, or Bitbucket.
-
Register the Snowflake redirect URI with your Git provider.
When you register the OAuth application, the provider asks for a redirect URI (sometimes called a callback URL). Set this to the following value, based on the cloud region that hosts your Snowflake account:
Replace
<region>and<cloud>with the values for your Snowflake deployment. For example, for an account in AWS US West (Oregon), the redirect URI ishttps://apps-api.c1.us-west-2.aws.app.snowflake.com/oauth/complete-secret. -
Create an API integration that specifies your OAuth2 parameters.
For details on each parameter, see CREATE API INTEGRATION.
-
Create a Git workspace as described in Create a Git workspace.
Configure for authenticating with a token¶

To have Snowflake authenticate with the Git repository by using a username and token such as a personal access token (PAT), follow these steps:
-
Provide credentials in a basic authentication secret.
To provide the credentials that Snowflake uses to authenticate with the repository, create a secret that contains the following:
-
A TYPE value of
password -
A username and token, such as a personal access token (PAT)
If your Git repository is hosted on Bitbucket, specify
x-token-authas the username value.Note
For information about creating a personal access token in GitHub, see Managing your personal access tokens in the GitHub documentation.
For more information on the SQL command for creating a secret, see the CREATE SECRET.
Code in the following example creates a secret called
my_git_secretwith a username and the user’s personal access token to use as credentials: -
-
Create an API integration that supports authenticating with a token.
To create an API integration for access to a Git repository with a token, specify the following details:
git_https_apias the value of the API_PROVIDER parameter- HTTPS endpoints to which requests must be limited as values of the API_ALLOWED_PREFIXES parameter
For more information, see CREATE API INTEGRATION.
-
Create a Git workspace as described in Create a Git workspace.
Configure for no authentication¶

To set up Snowflake to use a Git repository without authenticating, follow these steps:
-
Create an API integration that supports access without authenticating, and specify the following details:
git_https_apias the value of the API_PROVIDER parameter- HTTPS endpoints to which requests must be limited as values of the API_ALLOWED_PREFIXES parameter
For more information, see CREATE API INTEGRATION.
-
Create a Git workspace as described in Create a Git workspace.
Create a Git workspace¶
After you configure the API integration, create a workspace connected to the remote repository. The Git workspace belongs to the
user who creates it. The role selected in your Snowsight user menu determines which API integrations and secrets you can
select. That role must have the USAGE privilege on the API integration.
-
Sign in to Snowsight.
-
In the navigation menu, select Projects » Workspaces.
-
In the Workspaces menu, select From Git repository.
-
For Repository URL, paste the HTTPS URL of the remote repository.
-
From the API Integration menu, select the API integration that you configured.
-
Select the authentication method that matches your API integration:
- OAuth2: Select Sign in, and then authorize Snowflake with your Git provider.
- Personal access token: Select the secret that contains your token.
- Public repository: Select this option for a repository that doesn’t require authentication. You can’t push changes from the workspace to a public repository.
-
Select Create.
For details on each option, including the GitHub authorization steps and how to open the dialog with pre-filled fields, see Create a Git workspace.
Create a Git repository clone for Snowflake code¶
A Git repository clone is a read-only, schema-level object that’s owned by a role. Create one when Snowflake code such as tasks, stored procedures, or UDFs needs to reference repository files, for example as handler code or with EXECUTE IMMEDIATE FROM. You can’t create, edit, commit, or push files through a clone. For more information, see How a Git repository clone works.
A Git repository clone in Snowflake specifies the following details:
-
The remote repository’s origin
In Git,
originis the remote repository’s URL. Use that URL when setting up Snowflake to use a remote Git repository. The URL must use HTTPS. For example, you can retrieve the origin URL in the following ways:-
In the GitHub user interface, you can get the origin URL from the repository home page. Select the Code button, and then copy the HTTPS URL from the box displayed beneath the button.
-
From the command line, use the
git configcommand from within your local repository, as in the following example:The command produces output such as the following:
For reference information about
git config, see the git documentation.
-
-
Credentials, if needed, for Snowflake to use when authenticating with the repository
For the GIT_CREDENTIALS parameter, specify a Snowflake secret you created.
-
An API integration specifying details for Snowflake interaction with the repository API
You can create a Git repository clone by using either Snowsight or SQL.
Note
Before creating a Git repository clone, you’ll need to create a secret (if the remote repository requires authentication) and an API integration.
Code in the following example creates a Git repository clone called snowflake_extensions. The clone specifies
the my_git_api_integration API integration and the my_git_secret secret with credentials for authenticating.
-
Sign in to Snowsight.
-
In the navigation menu, select Catalog » Explorer.
-
In the Horizon Catalog Explorer, select the database and schema that you want to contain the Git repository clone you’re creating.
-
Select Create » Git Repository.
-
In the Create Git Repository dialog, for Repository Name, enter a name that will uniquely identify this repository clone in the schema.
For naming guidelines, see Identifier requirements.
-
For Origin, enter the remote repository’s origin URL.
-
From the API Integration drop-down menu, select the API integration to reference when creating the Git repository clone.
If you don’t have an API integration to use, select Create new API integration in Worksheets to use SQL to create one. For more information, see CREATE API INTEGRATION.
-
Optional: For the Comment, enter text describing this integration for others.
-
Optional: If the remote repository requires authentication, set the Authentication toggle to the on position.
-
If you turned on the toggle, from the Secret menu, select the secret that should be referenced by the Git integration to authenticate with the remote repository.
If you don’t have a secret to use, select Create new secret in Worksheets to use SQL to create one. For more information, see CREATE SECRET.
-
-
Select Create.
When you successfully create the integration, the Git repository clone appears beneath the schema, in a Git Repositories directory. You’ll also see a page that lists repository directories, branches, and tags.