Error creating new repository (PERMISSION_DENIED)

594 Views Asked by At

I have a problem creating a new repository in Cloud Source Repository (console or gcloud).

In the gcloud case, when I run the following command using either an user account with roles/owner or a service account with roles/source.admin:

gcloud source repos create new-repo

I get the following error:

ERROR: (gcloud.source.repos.create) ResponseError: status=[PERMISSION_DENIED], code=[403], message=[User [xxx@xxx] does not have permission to access projects instance [PROJECT_ID] (or it may not exist): The caller does not have permission].

The project currently has no repositories associated to it. I was able to create one earlier (through the console) which I then deleted before using. I have been unable to create any subsequent repositories since.

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

1

There are 1 best solutions below

2
On

As you mentioned to have the proper roles on the account this issue is due to not having a billing account linked to the project.

The API methods used to create a repository require the billing on the project to be enabled so to solve it if this is the issue you can perform the following steps

  • Go to https://console.cloud.google.com/billing
  • Select the project where you want the repository to reside
  • Click on Link a Billing Account
  • A Popup message will show, over there click on Create Billing Account
  • Follow the wizard