设置 Git 存储库¶
您可以将远程 Git 存储库与 Snowflake 集成,以便将存储库中的文件同步到一种称为 存储库暂存区 的特殊暂存区。存储库暂存区充当本地 Git 存储库,其中包含远程存储库的完整克隆,包括分支、标签和提交。
For more information, see Using a Git repository in Snowflake.
准备工作
在设置 Git 存储库之前,您需要以下信息:
- URL of the for the remote repository (also called the
originin Git). - 用于连接到 Git 的可选凭据,包括密钥、用户名和密码。
- 可选的 API 集成 ID。
- 具有创建 API 集成权限的角色或用户(如果您还没有 API 集成)。
For more information, see Setting up Snowflake to use Git.
设置 Git 存储库¶
To clone a Git repository into Git repository stage, use the snow git setup command, as shown:
其中:
<REPO_NAME>is the ID of the repository stage you want to create. Note that if the repository stage already exists, the command fails.
The snow git setup command provide a series of prompts to collect the necessary information, as shown in the following examples:
-
创建需要密钥和凭据的存储库:
-
创建一个没有密钥和现有 API 集成 ID 的存储库:
If the role or user specified in your connection has not been granted, executing this command generates an error similar to the following:
In this situation, you should check your connection configuration or ask your account administrator to give you the necessary privileges or to create the integration for you. For more information, see Setting up Snowflake to use Git