קישור מאגר המקורות של הקוד

‫Developer Connect מאפשר לכם לשלב מוצרים ושירותים שאינם של Google, כדי שתוכלו להשתמש בהם במוצרים נתמכים של Google.

במדריך למתחילים הזה נסביר איך להתחבר ל-GitHub באמצעות חיבור למאגר Git. החיבור הזה נדרש כשרוצים להשתמש בעיגון בקוד של הארגון ב-Gemini Code Assist.

רשימה של כל האינטגרציות שנתמכות על ידי Developer Connect מופיעה במאמר סקירה כללית של Developer Connect.

לפני שמתחילים

  1. נכנסים לחשבון Google Cloud . אם אתם משתמשים חדשים ב- Google Cloud, צרו חשבון כדי שתוכלו להעריך את הביצועים של המוצרים שלנו בתרחישים מהעולם האמיתי. לקוחות חדשים מקבלים בחינם גם קרדיט בשווי 300$ להרצה, לבדיקה ולפריסה של עומסי העבודה.
  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. מוודאים שיש לכם חשבון ב-GitHub וגישה למאגר שמתארח ב-GitHub.com. לחלופין, אפשר לעיין במסמכי התיעוד של GitHub כדי ליצור חשבונות ומאגרים חדשים:
  11. אם אתם משתמשים במאגר קיים ואתם לא הבעלים שלו, אתם צריכים לבקש מהבעלים להעניק לכם הרשאות אדמין למאגר. אם המאגר נמצא בארגון GitHub, צריך לבקש הרשאות ברמת האדמין מבעלי הארגון. מידע נוסף על ארגונים ב-GitHub זמין במאמר סוגי חשבונות ב-GitHub.

יצירת חיבור

  1. פותחים את הדף Developer Connect במסוף Google Cloud .

    כניסה אל Developer Connect

    נפתח הדף Git Repositories (מאגרי Git), שבו מוצגת רשימה של ספקי ניהול קוד מקור.

  2. לוחצים על Connect (קישור) בכרטיס של ספק ניהול קוד המקור כדי לבחור אותו.

    ייפתח הדף Create connection (יצירת קישור).

  3. בוחרים באזור us-central1.

  4. מזינים את השם quickstart-connection.

  5. לוחצים על Continue.

    מופיעה תיבת הדו-שיח Google Developer Connect שבה מתבקשת הרשאה לשימוש באסימון ה-OAuth של GitHub.

    אם לא מופיע תיבת דו-שיח, צריך להשבית את כל תוספי הדפדפן שחוסמים חלונות קופצים ולוודא שהגדרות הדפדפן מאפשרות חלונות קופצים. לדוגמה, ב-Chrome, צריך לפעול לפי ההוראות כדי לאשר חלונות קופצים.

  6. לוחצים על הבנתי, אפשר להמשיך.

  7. אם מוצגת בקשה, מבצעים את השלבים לכניסה לחשבון ב-GitHub.

  8. אם מוצגת בקשה, לוחצים על Authorize Developer Connect (אישור של Developer Connect). אם הבקשה לא מוצגת, סימן שההרשאה כבר ניתנה בחשבון הזה.

הגדרת החיבור

כדי להעניק הרשאות לחשבון ולמאגרים שלכם ב-GitHub, פועלים לפי השלבים הבאים. ההנחיות משתנות בהתאם לשאלה אם מישהו שמשתמש בחשבון GitHub כבר התקין את אפליקציית Google Developer Connect ב-GitHub.

  • אם מופיעה רשימה של חשבונות GitHub: האפליקציה עדיין לא מותקנת. כדי להתקין ולהגדיר אותו:

    1. בוחרים את החשבון ב-GitHub שיש לו גישה למאגר שרוצים לקשר.

    2. מציינים את ההרשאות למאגר ב-GitHub ומתקינים את האפליקציה. מידע נוסף זמין בהוראות של GitHub בנושא התקנת אפליקציות.

  • אם מופיעה בקשה להשתמש בהתקנה קיימת: בוחרים איפה להתקין את האפליקציה ולהגדיר אותה לפי השלבים הבאים:

    1. לוחצים על GitHub Account כדי לראות את החשבונות שבהם האפליקציה מותקנת. אם אתם רואים את החשבון שבו אתם רוצים להשתמש, בחרו אותו.

      1. לוחצים על אישור.
    2. אם החשבון שבו רוצים להשתמש לא מופיע, בוחרים באפשרות Install the GitHub App on another GitHub account (התקנת אפליקציית GitHub בחשבון אחר ב-GitHub).

      1. לוחצים על אישור.

      2. בוחרים את החשבון ב-GitHub שבו רוצים להשתמש.

      3. מציינים את ההרשאות למאגר ב-GitHub ומתקינים את האפליקציה. מידע נוסף זמין בהוראות של GitHub בנושא התקנת אפליקציות.

  1. בקטע Repositories (מאגרים), בוחרים את המאגר שרוצים לקשר.

  2. לוחצים על קישור.

החיבור נוסף לרשימת החיבורים, והמאגר המקושר נוסף לרשימת המאגרים.

הסרת המשאבים

כדי לא לצבור חיובים לחשבון Google Cloud על המשאבים שבהם השתמשתם בדף הזה, פועלים לפי השלבים הבאים:

  1. נכנסים לדף Developer Connect במסוף Google Cloud .

    כניסה אל Developer Connect

  2. בכרטיסייה Repositories, בשורה שמכילה את השם של המאגר המקושר, לוחצים על More options.

  3. בוחרים באפשרות ביטול הקישור.

  4. לוחצים על אישור.

  5. לוחצים על הכרטיסייה Connections (קישורים).

  6. בשורה עם השם של איש הקשר, לוחצים על אפשרויות נוספות.

  7. בוחרים באפשרות מחיקה.

  8. מזינים את שם החיבור.

  9. לוחצים על אישור.

מחיקת קישורים וחיבורים לא מוחקת את המאגרים ב-GitHub.com. אם יצרתם מאגר חדש ב-GitHub בשביל ההפעלה המהירה הזו ואתם רוצים למחוק אותו, אתם יכולים לפעול לפי ההוראות של GitHub למחיקת מאגר.

אם רוצים להסיר את אפליקציית Google Developer Connect, פועלים לפי ההוראות של GitHub בנושא שינוי אפליקציות מותקנות.

המאמרים הבאים