ソースコード リポジトリを接続する
Developer Connect を使用すると、Google 以外のプロダクトやサービスと統合して、サポートされている Google プロダクトで使用できます。
このクイックスタートでは、GitHub を使用して GitHubに接続する方法について説明します。この タイプの接続は、 Gemini Code Assist コードのカスタマイズを使用する場合に必要です。
Developer Connect でサポートされているすべての統合の一覧については、 Developer Connect の概要をご覧ください。
始める前に
- アカウントにログインします。 Google Cloud を初めて使用する場合は、 アカウントを作成して、実際のシナリオで Google プロダクトのパフォーマンスを評価してください。 Google Cloud新規のお客様には、ワークロードの実行、テスト、デプロイができる無料クレジット $300 分を差し上げます。
-
In the Google Cloud console, on the project selector page, select or create a Google Cloud project.
Roles required to select or create a project
- Select a project: Selecting a project doesn't require a specific IAM role—you can select any project that you've been granted a role on.
-
Create a project: To create a project, you need the Project Creator role
(
roles/resourcemanager.projectCreator), which contains theresourcemanager.projects.createpermission. Learn how to grant roles.
-
Verify that billing is enabled for your Google Cloud project.
Enable the Developer Connect and Secret Manager APIs.
Roles required to enable APIs
To enable APIs, you need the Service Usage Admin IAM role (
roles/serviceusage.serviceUsageAdmin), which contains theserviceusage.services.enablepermission. Learn how to grant roles.-
Make sure that you have the following role or roles on the project: Developer Connect Admin
Check for the roles
-
In the Google Cloud console, go to the IAM page.
Go to IAM - Select the project.
-
In the Principal column, find all rows that identify you or a group that you're included in. To learn which groups you're included in, contact your administrator.
- For all rows that specify or include you, check the Role column to see whether the list of roles includes the required roles.
Grant the roles
-
In the Google Cloud console, go to the IAM page.
Go to IAM - Select the project.
- Click Grant access.
-
In the New principals field, enter your user identifier. This is typically the email address for a Google Account.
- Click Select a role, then search for the role.
- To grant additional roles, click Add another role and add each additional role.
- Click Save.
-
-
In the Google Cloud console, on the project selector page, select or create a Google Cloud project.
Roles required to select or create a project
- Select a project: Selecting a project doesn't require a specific IAM role—you can select any project that you've been granted a role on.
-
Create a project: To create a project, you need the Project Creator role
(
roles/resourcemanager.projectCreator), which contains theresourcemanager.projects.createpermission. Learn how to grant roles.
-
Verify that billing is enabled for your Google Cloud project.
Enable the Developer Connect and Secret Manager APIs.
Roles required to enable APIs
To enable APIs, you need the Service Usage Admin IAM role (
roles/serviceusage.serviceUsageAdmin), which contains theserviceusage.services.enablepermission. Learn how to grant roles.-
Make sure that you have the following role or roles on the project: Developer Connect Admin
Check for the roles
-
In the Google Cloud console, go to the IAM page.
Go to IAM - Select the project.
-
In the Principal column, find all rows that identify you or a group that you're included in. To learn which groups you're included in, contact your administrator.
- For all rows that specify or include you, check the Role column to see whether the list of roles includes the required roles.
Grant the roles
-
In the Google Cloud console, go to the IAM page.
Go to IAM - Select the project.
- Click Grant access.
-
In the New principals field, enter your user identifier. This is typically the email address for a Google Account.
- Click Select a role, then search for the role.
- To grant additional roles, click Add another role and add each additional role.
- Click Save.
-
- GitHub アカウントと GitHub.com でホストされているリポジトリへのアクセス権があることを確認します。または、GitHub のドキュメントに沿って新しいアカウントを作成します。
- 既存のリポジトリを使用しているが、自分がオーナーでない場合は、オーナーにリポジトリの管理者レベルの権限を付与するよう依頼します。リポジトリが GitHub 組織にある場合は、組織のオーナーに管理者レベルの権限をリクエストします。GitHub 組織の詳細については、GitHub アカウント タイプをご覧ください。
接続を開始する
コンソールで [Developer Connect] ページを開きます。 Google Cloud
[Git リポジトリ] ページが開き、ソースコード管理プロバイダのリストが表示されます。
プロバイダのカードで [接続] をクリックして、ソースコード管理プロバイダを選択します。
[接続を作成] ページが開きます。
リージョンとして
us-central1を選択します。名前として
quickstart-connectionを入力します。[続行] をクリックします。
[Google Developer Connect] ダイアログが表示され、GitHub OAuth トークンの使用を承認するよう求められます。
ダイアログが表示されない場合は、ポップアップ ブロック ブラウザ プラグインを無効にして、ブラウザ設定でポップアップが許可されていることを確認します。たとえば、Chrome で、 ポップアップを許可する手順は次のとおりです。
[同意して続行] をクリックします。
GitHub アカウントのログイン手順を完了します(求められた場合)。
[Authorize Developer Connect] をクリックします(求められた場合)。このプロンプトが表示されない場合は、このアカウントですでに承認が付与されています。
接続を構成する
次の手順で、GitHub アカウントとリポジトリに対する権限を付与します。プロンプトは、GitHub アカウントを使用しているユーザーが GitHub に Google Developer Connect アプリをすでにインストールしているかどうかによって異なります。
GitHub アカウントのリストが表示される場合: アプリはまだインストールされていません。次の手順でインストールして構成します。
リンクするリポジトリへのアクセス権を持つ GitHub アカウントを選択します。
GitHub リポジトリの権限を指定して、アプリをインストールします。 詳細については、アプリのインストールに関する GitHub の手順をご覧ください。
既存のインストールを再利用するよう求めるプロンプトが表示される場合: 次の手順で、アプリをインストールして構成する場所を 選択します。
[GitHub アカウント] をクリックして、アプリがインストールされているアカウントを表示します。使用するアカウントが表示されたら、選択します。
- [確認] をクリックします。
使用するアカウントが表示されない場合は、[GitHub アプリを別の GitHub アカウントにインストールする] を選択します。
[確認] をクリックします。
使用する GitHub アカウントを選択します。
GitHub リポジトリの権限を指定して、アプリをインストールします。 詳細については、アプリのインストールに関する GitHub の手順をご覧ください。
[**リポジトリ**] で、リンクするリポジトリを選択します。
[リンク] をクリックします。
接続が接続リストに追加され、リンクされたリポジトリがリポジトリ リストに追加されます。
クリーンアップ
このページで使用したリソースについて、 Google Cloud アカウントに課金されないようにするには、 次の手順を実施します。
コンソールで、[Developer Connect] ページに移動します。 Google Cloud
[リポジトリ] タブで、リンクされた リポジトリの名前を含む行で、 [その他のオプション] をクリックします。
[リンクを解除] を選択します。
[確認] をクリックします。
[接続] タブをクリックします。
接続の名前を含む行で、 [その他のオプション] をクリックします。
[削除] を選択します。
接続の名前を入力します。
[確認] をクリックします。
接続とリンクを削除しても、GitHub.com のリポジトリは削除されません。 このクイックスタート用に新しい GitHub リポジトリを作成し、そのリポジトリを 削除する場合は、GitHub の リポジトリを削除する手順に沿って操作してください。
Google Developer Connect アプリをアンインストールする場合は、 インストール済みアプリの変更に関する GitHub の手順に沿って操作してください。