A partire dal 17 giugno 2024, Cloud Source Repositories non è disponibile per i nuovi clienti. Se la tua organizzazione non ha mai utilizzato Cloud Source Repositories, non puoi attivare l'API o utilizzare Cloud Source Repositories. I nuovi progetti non collegati a un'organizzazione non possono attivare l'API Cloud Source Repositories. Questa modifica non interessa le organizzazioni che hanno utilizzato Cloud Source Repositories prima del 17 giugno 2024.
Concedere l'accesso utente a repository e progetti
Mantieni tutto organizzato con le raccolte
Salva e classifica i contenuti in base alle tue preferenze.
Questo argomento descrive come puoi fornire agli utenti l'accesso a repository e progetti e quali azioni possono intraprendere. Ecco alcuni esempi di azioni utente:
Concedi le autorizzazioni per eseguire push dei commit
Gli utenti con questo livello di autorizzazioni possono inviare modifiche a un repository. Possono anche eseguire tutte le azioni descritte in Visualizzazione dei repository.
Se viene concessa questa autorizzazione a livello di progetto, gli utenti possono inviare le modifiche
a tutti i repository del progetto.
Concedere le autorizzazioni push per un repository
Console
Nella Google Cloud console, apri Cloud Source Repositories nella scheda della visualizzazione La mia origine
Fai clic sul nome di un repository.
Si apre la visualizzazione File.
Fai clic su Impostazionisettings.
Si apre la pagina Impostazioni generali.
Fai clic su Autorizzazioni.
Viene visualizzata la pagina Autorizzazioni.
Nel campo Membri, inserisci l'indirizzo email dell'utente.
Nell'elenco a discesa Ruolo, seleziona
Repository di origine > Scrittore del repository di origine.
[[["Facile da capire","easyToUnderstand","thumb-up"],["Il problema è stato risolto","solvedMyProblem","thumb-up"],["Altra","otherUp","thumb-up"]],[["Difficile da capire","hardToUnderstand","thumb-down"],["Informazioni o codice di esempio errati","incorrectInformationOrSampleCode","thumb-down"],["Mancano le informazioni o gli esempi di cui ho bisogno","missingTheInformationSamplesINeed","thumb-down"],["Problema di traduzione","translationIssue","thumb-down"],["Altra","otherDown","thumb-down"]],["Ultimo aggiornamento 2025-09-04 UTC."],[],[],null,["# Granting user access to repositories and projects\n\nThis topic describes how you can provide users access to repositories and\nprojects, and what actions those users can take. Examples of user actions\ninclude the following:\n\n- Listing repositories\n- Creating new repositories\n- Updating repositories\n\nFor a complete list of actions, see\n[Roles and permissions matrix](/source-repositories/docs/configure-access-control#roles_and_permissions_matrix).\n\nGrant permissions to view repositories\n--------------------------------------\n\nUsers with this level of permissions can view the contents of a repository. They\ncan also clone and fetch the repository.\n\nIf granted this permission at the project level, users can view all repositories\nfor that project.\n\n### Grant viewing permissions for a repository\n\n### Console\n\n1. In the Google Cloud console, open Cloud Source Repositories in the [My source](https://source.cloud.google.com/) view tab\n\n2. Click the name of a repository.\n\n The **Files** view opens.\n3. Click\n **Settings** *settings*.\n\n The **General settings** page opens.\n4. Click **Permissions**.\n\n The **Permissions** page opens.\n5. In the **Members** field, enter the user's email address.\n\n6. In the **Role** drop-down list, select\n **Source repository \\\u003e Source Repository Reader**.\n\n7. Click **Add**.\n\n### Command line\n\n1. Open a terminal window.\n\n2. Enter the following command:\n\n gcloud source repos set-iam-policy [REPO_NAME] [POLICY_FILE] [GCLOUD_WIDE_FLAG ...]\n\n Where:\n - `[REPO_NAME]` is the name of the repository.\n - `[POLICY_FILE]` is the JSON or YAML file with the Identity and Access Management policy.\n\nFor more information on this command, see\n[gcloud source repos set-iam-policy](/sdk/gcloud/reference/source/repos/set-iam-policy).\n\n### Grant viewing permissions across a project\n\n### Console\n\n1. In the Google Cloud console, open Cloud Source Repositories in the [My source](https://source.cloud.google.com/) view tab\n\n2. Click the name of a Google Cloud project ID for a specific repository.\n\n The page displays a list of all repositories for that project.\n3. Click\n **Settings** *settings*.\n\n The **General settings** page opens.\n4. Click **Permissions**.\n\n The **Permissions** page opens.\n5. In the **Members** field, enter the user's email address.\n\n6. In the **Role** drop-down list, select\n **Source repository \\\u003e Source Repository Reader**.\n\n7. Click **Add**.\n\n### Command line\n\n1. Open a terminal window.\n\n2. Enter the following command:\n\n gcloud projects add-iam-policy-binding [PROJECT_ID] --member=[MEMBER] \\\n --role=[ROLE] [GCLOUD_WIDE_FLAG ...]\n\n Where:\n - `[PROJECT_ID]` is the ID for your Google Cloud project.\n - `[MEMBER]` is the user you want to add.\n - `[ROLE]` is the IAM role you want to assign.\n\nFor more information on this command, see\n[gcloud projects add-iam-policy-binding](/sdk/gcloud/reference/projects/add-iam-policy-binding).\n\nGrant permissions to push commits\n---------------------------------\n\nUsers with this level of permissions can push changes to a repository. They can\nalso perform all the actions described in\n[Viewing repositories](#viewing_repositories).\n\nIf granted this permission at the project level, users can push changes\nto all repositories in that project.\n\n### Grant push permissions for a repository\n\n### Console\n\n1. In the Google Cloud console, open Cloud Source Repositories in the [My source](https://source.cloud.google.com/) view tab\n\n2. Click the name of a repository.\n\n The **Files** view opens.\n3. Click\n **Settings** *settings*.\n\n The **General settings** page opens.\n4. Click **Permissions**.\n\n The **Permissions** page opens.\n5. In the **Members** field, enter the user's email address.\n\n6. In the **Role** drop-down list, select\n **Source repository \\\u003e Source Repository Writer**.\n\n7. Click **Add**.\n\n### Command line\n\n1. Open a terminal window.\n\n2. Enter the following command:\n\n gcloud source repos set-iam-policy [REPO_NAME] [POLICY_FILE] [GCLOUD_WIDE_FLAG ...]\n\n Where:\n - `[REPO_NAME]` is the name of the repository.\n - `[POLICY_FILE]` is the JSON or YAML file with the IAM policy.\n\nFor more information on this command, see\n[gcloud source repos set-iam-policy](/sdk/gcloud/reference/source/repos/set-iam-policy).\n\n### Grant push permissions for a project\n\n### Console\n\n1. In the Google Cloud console, open Cloud Source Repositories in the [My source](https://source.cloud.google.com/) view tab\n\n2. Click the name of a Google Cloud project ID for a specific\n repository.\n\n The page displays a list of all repositories for that project.\n3. Click\n **Settings** *settings*.\n\n The **General settings** page opens.\n4. Click **Permissions**.\n\n The **Permissions** page opens.\n5. In the **Members** field, enter the user's email address .\n\n6. In the **Role** drop-down list, select\n **Source Repository \\\u003e Source Repository Writer**.\n\n7. Click **Add**.\n\n### Command line\n\n1. Open a terminal window.\n\n2. Enter the following command:\n\n gcloud projects add-iam-policy-binding [PROJECT_ID] --member=[MEMBER] \\\n --role=[ROLE] [GCLOUD_WIDE_FLAG ...]\n\n Where:\n - `[PROJECT_ID]` is the ID for your Google Cloud project.\n - `[MEMBER]` is the user you want to add.\n - `[ROLE]` is the IAM role you want to assign.\n\nFor more information on this command, see\n[gcloud projects add-iam-policy-binding](/sdk/gcloud/reference/projects/add-iam-policy-binding).\n\nGrant permissions to create and delete repositories\n---------------------------------------------------\n\n\u003cbr /\u003e\n\nIf granted this permission at the project level, users can create, update, and\ndelete repositories for the entire project.\n\n1. In the Google Cloud console, open Cloud Source Repositories in the [My source](https://source.cloud.google.com/) view tab\n\n2. Click the name of a Google Cloud project ID for a specific repository.\n\n The page displays a list of all repositories for that project.\n3. Click\n **Settings** *settings*.\n\n The **General settings** page opens.\n4. Click **Permissions**.\n\n The **Permissions** page opens.\n5. In the **Members** field, enter the user's email address.\n\n6. In the **Role** drop-down list, select\n **Source repository \\\u003e Source Repository Administrator**.\n\n7. Click **Add**.\n\nRemove a user's access\n----------------------\n\nThere may be cases where you need to remove a user's access to a repository or\nproject.\n\n### Remove access to a repository\n\n1. In the Google Cloud console, open Cloud Source Repositories in the [My source](https://source.cloud.google.com/) view tab\n\n2. Click on the name of a repository.\n\n The **Files** view opens.\n3. Click\n **Settings** *settings*.\n\n The **General settings** page opens.\n4. Click **Permissions**.\n\n5. Locate the role you want to remove, and then click\n **Delete** *delete*\n for that role.\n\n A confirmation dialog opens.\n6. Click **Remove**.\n\n### Remove access to a project\n\n1. In the Google Cloud console, open Cloud Source Repositories in the [My source](https://source.cloud.google.com/) view tab\n\n2. Click the name of a Google Cloud project ID for a specific repository.\n\n The page displays a list of all repositories for that project.\n3. Click\n **Settings** *settings*.\n\n The **General settings** page opens.\n4. Click **Permissions**.\n\n The **Permissions** page opens.\n5. Locate the role you want to remove, and then click\n **Delete** *delete*\n for that role.\n\n A confirmation dialog opens.\n6. Click **Remove**.\n\nWhat's next\n-----------\n\n- Learn more about\n [Cloud Source Repositories and access control](/source-repositories/docs/configure-access-control).\n\n- Learn more about [IAM](/iam/docs)."]]