1

I have assigned the Source Repository Administrator to a team member in Google Source Repositories for a Google Cloud project, but they're still unable to create a new repository in this project.

Would love to hear some suggestions if anyone else has faced a similar issue.

battery
  • 502
  • 6
  • 26
  • I understand that you assigned Source Repository Administrator to another team member( which has a Google Account ) or created a service account for him. The team member is not able to create the repository from his project. Can you post the error message when he fails? – marian.vladoi Dec 11 '19 at 13:05
  • @marian.vladoi They see a popup toast saying "Repository creation failed" – battery Dec 11 '19 at 13:44
  • I just spent 15 minutes wondering why I couldn't create a repo via gcloud for a project I own. I finally realized I accidentally `gcloud config project set aprojectname` to the display name of the project and not the project_id (`gcloud projects list`), which proceeds but gives a yellow warning I missed. I made the mistake because I thought the project name was unique (which could be a common/your issue) – weezilla Mar 21 '20 at 00:14

2 Answers2

1

In my case, the sourcerepo API hadn't been enabled for the project.

Once done (e.g. gcloud services enable sourcerepo.googleapis.com --project=<project-id>, all was well.

u-phoria
  • 364
  • 4
  • 13
0
  1. I created a new project 'repo'.

  2. I assigned the permissions to the new user in the 'repo' project:

    gcloud projects add-iam-policy-binding repo --member user:user@gmail.com --role roles/source.admin
    
  3. I checked the 'repo' project to have the following services account:

    service-1111111@sourcerepo-service-accounts.iam.gserviceaccount.com (Cloud Source Repositories Service Agent for Project 754848704710 ) Role: Cloud Source Repositories Service Agent
    
    user@gmai.com  Role: Source Repository Administrator
    
  4. I login to user@gmail.com project and run the command:

    gcloud source repos create  test_repo --project repo 
    Created [test_repo].
    
  5. I login to 'repo' project and run the command:

    gcloud source repos list
    test_repo  repo  https://source.developers.google.com/p/repo/r/test_repo
    

Everything worked as expected for me.

Cloud Source Repositories uses Cloud Identity and Access Management to grant permissions to users. If a user cannot perform a specific action, such as create a new repository, check to ensure they have the correct IAM permissions

marian.vladoi
  • 7,663
  • 1
  • 15
  • 29