Gitリポジトリの設定

リモートのGitリポジトリをSnowflakeと統合することで、リポジトリからのファイルを リポジトリステージ と呼ばれる特別なステージに同期させることができます。リポジトリステージは、ブランチ、タグ、コミットを含むリモートリポジトリの完全なクローンを持つローカルGitリポジトリとして動作します。

詳細については、 SnowflakeでのGitリポジトリの使用 をご参照ください。

ご使用の前に

Gitリポジトリを設定する前に、次の情報が必要です。

  • リモートリポジトリの URL (Gitでは origin とも呼ばれます)。

  • シークレット、ユーザー名、パスワードなど、Gitに接続するためのオプションの認証情報。

  • オプションの API 統合 ID。

  • API 統合がまだない場合は、 API 統合を作成する権限を持つロールまたはユーザー。

この情報の詳細については、 認証用の認証情報を含むシークレットを作成する をご参照ください。

Gitリポジトリを設定する

GitリポジトリをGitリポジトリステージにクローンするには、次に示されるように:codenowrap:snow git setup コマンドを使用します。

snow git setup <REPO_NAME>
Copy

条件:

  • <REPO_NAME> は作成するリポジトリステージの ID です。リポジトリステージがすでに存在する場合、コマンドは失敗することに注意してください。

snow git setup コマンドは、次の例に示すように、必要な情報を収集するための一連のプロンプトを提供します。

  • シークレットと認証情報を必要とするリポジトリを作成します。

    $ snow git setup snowcli_git
    Origin url: https://github.com/snowflakedb/snowflake-cli.git
    Use secret for authentication? [y/N]: y
    Secret identifier (will be created if not exists) [snowcli_git_secret]: new_secret
    Secret 'new_secret' will be created
    username: john_doe
    password/token: ****
    API integration identifier (will be created if not exists) [snowcli_git_api_integration]:
    
    Copy
    Secret 'new_secret' successfully created.
    API integration snowcli_git_api_integration successfully created.
    +------------------------------------------------------+
    | status                                               |
    |------------------------------------------------------|
    | Git Repository SNOWCLI_GIT was successfully created. |
    +------------------------------------------------------+
    
  • シークレットと既存の API 統合 ID なしでリポジトリを作成します。

    $ snow git setup snowcli_git
    Origin url: https://github.com/snowflakedb/snowflake-cli.git
    Use secret for authentication [y/N]: n
    API integration identifier (will be created if not exists) [snowcli_git_api_integration]: EXISTING_INTEGRATION
    
    Copy
    Using existing API integration 'EXISTING_INTEGRATION'.
    +------------------------------------------------------+
    | status                                               |
    |------------------------------------------------------|
    | Git Repository SNOWCLI_GIT was successfully created. |
    +------------------------------------------------------+
    

接続 で指定されたロールまたはユーザーが付与されていない場合、このコマンドを実行すると次のようなエラーが発生します。

003001 (42501): 01b2f095-0508-c66d-0001-c1be009a66ee: SQL access control error: Insufficient privileges to operate on account XXX
Copy

このような場合は、接続構成を確認するか、アカウント管理者に必要な権限を与えてもらうか、統合を作成するように依頼する必要があります。詳細については、 リポジトリ API とやり取りするための API 統合を作成する をご参照ください。