Menghubungkan repositori kode sumber

Developer Connect memungkinkan Anda berintegrasi dengan produk dan layanan non-Google sehingga Anda dapat menggunakannya di produk Google yang didukung.

Panduan memulai ini menunjukkan cara menghubungkan ke GitHub menggunakan koneksi repositori Git. Jenis koneksi ini diperlukan saat Anda ingin menggunakan penyesuaian kode Gemini Code Assist.

Untuk mengetahui daftar semua integrasi yang didukung Developer Connect, lihat Ringkasan Developer Connect.

Sebelum memulai

  1. Login ke akun Google Cloud Anda. Jika Anda baru menggunakan Google Cloud, buat akun untuk mengevaluasi performa produk kami dalam skenario dunia nyata. Pelanggan baru juga mendapatkan kredit gratis senilai $300 untuk menjalankan, menguji, dan men-deploy workload.
  2. 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 the resourcemanager.projects.create permission. Learn how to grant roles.

    Go to project selector

  3. Verify that billing is enabled for your Google Cloud project.

  4. 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 the serviceusage.services.enable permission. Learn how to grant roles.

    Enable the APIs

  5. Make sure that you have the following role or roles on the project: Developer Connect Admin

    Check for the roles

    1. In the Google Cloud console, go to the IAM page.

      Go to IAM
    2. Select the project.
    3. 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.

    4. 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

    1. In the Google Cloud console, go to the IAM page.

      Go to IAM
    2. Select the project.
    3. Click Grant access.
    4. In the New principals field, enter your user identifier. This is typically the email address for a Google Account.

    5. Click Select a role, then search for the role.
    6. To grant additional roles, click Add another role and add each additional role.
    7. Click Save.
  6. 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 the resourcemanager.projects.create permission. Learn how to grant roles.

    Go to project selector

  7. Verify that billing is enabled for your Google Cloud project.

  8. 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 the serviceusage.services.enable permission. Learn how to grant roles.

    Enable the APIs

  9. Make sure that you have the following role or roles on the project: Developer Connect Admin

    Check for the roles

    1. In the Google Cloud console, go to the IAM page.

      Go to IAM
    2. Select the project.
    3. 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.

    4. 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

    1. In the Google Cloud console, go to the IAM page.

      Go to IAM
    2. Select the project.
    3. Click Grant access.
    4. In the New principals field, enter your user identifier. This is typically the email address for a Google Account.

    5. Click Select a role, then search for the role.
    6. To grant additional roles, click Add another role and add each additional role.
    7. Click Save.
  10. Pastikan Anda memiliki akun GitHub dan akses ke repositori yang dihosting di GitHub.com. Atau, ikuti dokumentasi GitHub untuk membuat repositori baru:
  11. Jika Anda menggunakan repositori yang ada dan Anda bukan pemiliknya, minta pemilik untuk memberikan izin tingkat admin ke repositori. Jika repositori berada di organisasi GitHub, minta izin tingkat admin dari pemilik organisasi. Untuk mempelajari organisasi GitHub lebih lanjut, lihat jenis akun GitHub.

Memulai koneksi

  1. Buka halaman Developer Connect di Google Cloud konsol.

    Buka Developer Connect

    Halaman Git Repositories akan terbuka, menampilkan daftar penyedia pengelolaan kode sumber.

  2. Pilih penyedia pengelolaan kode sumber dengan mengklik Hubungkan di kartu untuk penyedia tersebut.

    Halaman Create connection akan terbuka.

  3. Pilih us-central1 sebagai wilayah.

  4. Masukkan quickstart-connection sebagai nama.

  5. Klik Lanjutkan.

    Dialog Google Developer Connect akan muncul dan meminta otorisasi untuk menggunakan token OAuth GitHub Anda.

    Jika Anda tidak melihat dialog, nonaktifkan plug-in browser yang memblokir pop-up dan pastikan setelan browser Anda mengizinkan pop-up. Misalnya, di Chrome, ikuti petunjuk untuk mengizinkan pop-up.

  6. Klik Saya mengerti dan lanjutkan.

  7. Selesaikan langkah-langkah login akun GitHub jika diminta untuk melakukannya.

  8. Klik Otorisasi Developer Connect jika diminta untuk melakukannya. Jika Anda tidak melihat perintah ini, otorisasi telah diberikan di akun ini.

Mengonfigurasi koneksi

Berikan izin di akun dan repositori GitHub Anda menggunakan langkah-langkah berikut. Perintah yang muncul bergantung pada apakah seseorang yang menggunakan akun GitHub telah menginstal aplikasi Google Developer Connect di GitHub atau belum.

  • Jika Anda melihat daftar akun GitHub: Anda belum menginstal aplikasi. Instal dan konfigurasikan dengan mengikuti langkah-langkah berikut:

    1. Pilih akun GitHub yang memiliki akses ke repositori yang ingin Anda tautkan.

    2. Tentukan izin repositori GitHub dan instal aplikasi. Untuk mengetahui informasi selengkapnya, lihat petunjuk GitHub tentang menginstal aplikasi.

  • Jika Anda melihat perintah untuk menggunakan kembali penginstalan yang ada: Pilih tempat untuk menginstal dan mengonfigurasi aplikasi dengan mengikuti langkah-langkah berikut:

    1. Klik Akun GitHub untuk melihat akun yang telah menginstal aplikasi. Jika Anda melihat akun yang ingin digunakan, pilih akun tersebut.

      1. Klik Konfirmasi.
    2. Jika Anda tidak melihat akun yang ingin digunakan, pilih Instal Aplikasi GitHub di akun GitHub lain.

      1. Klik Konfirmasi.

      2. Pilih akun GitHub yang ingin Anda gunakan.

      3. Tentukan izin repositori GitHub dan instal aplikasi. Untuk mengetahui informasi selengkapnya, lihat petunjuk GitHub tentang menginstal aplikasi.

  1. Di Repositori, pilih repositori yang ingin Anda tautkan.

  2. Klik Tautkan.

Koneksi ditambahkan ke daftar koneksi, dan repositori yang ditautkan ditambahkan ke daftar repositori.

Pembersihan

Agar akun Google Cloud Anda tidak dikenai biaya untuk resource yang digunakan pada halaman ini, ikuti langkah-langkah berikut.

  1. Di konsol Google Cloud , buka halaman Developer Connect.

    Buka Developer Connect

  2. Di tab Repositories, di baris yang berisi nama repositori tertaut, klik More options.

  3. Pilih Batalkan tautan.

  4. Klik Konfirmasi.

  5. Klik tab Koneksi.

  6. Di baris yang berisi nama koneksi Anda, klik Opsi lainnya.

  7. Pilih Hapus.

  8. Masukkan nama koneksi Anda.

  9. Klik Konfirmasi.

Menghapus koneksi dan link tidak akan menghapus repositori di GitHub.com. Jika Anda membuat repositori GitHub baru untuk panduan memulai cepat ini dan ingin menghapus repositori, ikuti petunjuk GitHub untuk menghapus repositori.

Jika Anda ingin meng-uninstal aplikasi Google Developer Connect, ikuti petunjuk GitHub tentang memodifikasi aplikasi yang diinstal.

Langkah berikutnya