Effective June 17, 2024, Cloud Source Repositories isn't available to new customers. If your organization hasn't previously used Cloud Source Repositories, you can't enable the API or use Cloud Source Repositories. New projects not connected to an organization can't enable the Cloud Source Repositories API. Organizations that have used Cloud Source Repositories prior to June 17, 2024 are not affected by this change.
Stay organized with collections
Save and categorize content based on your preferences.
This topic describes how you can provide users access to repositories and
projects, and what actions those users can take. Examples of user actions
include the following:
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-28 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)."]]