user1752168
user1752168

Reputation: 56

fail to create repository [datalab-notebooks] for Project

Try to create a datalab session following this page: https://cloud.google.com/datalab/docs/quickstarts

$ datalab create junlab

ERROR: (gcloud.alpha.source.repos.create) Failed to create repository [datalab-notebooks] for Project [thinking-star-140602] with error

The caller does not have permission

PERMISSION_DENIED

A nested call to gcloud failed.

But actually I am the owner of the project.

Any idea?

Upvotes: 2

Views: 1275

Answers (4)

Wilhelm de Fheur Gorm
Wilhelm de Fheur Gorm

Reputation: 339

7 years later if you're getting this error, see the message here

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.

Upvotes: 0

leerssej
leerssej

Reputation: 14988

You may need to enable the Cloud Source Repositories API.

The easiest way to do this is to click on the link that can sometimes be within the error message you receive - like below but with your own account specifics and your project name at the end: https://console.cloud.google.com/apis/library/sourcerepo.googleapis.com/?project=<YOUR-PROJECT-NAME>

and may be hidden within the error message you received much like this:

ERROR: (gcloud.source.repos.create) ResponseError: status=[PERMISSION_DENIED],
code=[403], message=[User[<YOURACCOUNT@gmail.com>] does not have permission to access 
project[<YOUR-PROJECT-NAME>] (or it may not exist): The caller does not have permission].
details:
- Cloud Source Repositories API is not enabled. Please enable the API on the Google
  Cloud console. 
  enable at: https://console.cloud.google.com/apis/library/sourcerepo.googleapis.com/?project=<YOUR-PROJECT-NAME>
Failed to find or create the repository datalab-notebooks.
Ask a project owner to create it for you.

Hover over the address listed in the error message in your google cloud shell and you will even get a hyperlink to take you right there. Enable it when the page finishes opening.

Alternatively, you can track the API down by going to APIs & Services/Library and searching for Cloud Source Repositories. Click on the card that comes up, and then when the destination page finishes loading, click the ENABLE button.

You should be able to run the
datalab create junlab command in your google cloud shell now without issue.

Upvotes: 0

moonbury castle
moonbury castle

Reputation: 31

I have encountered similar problem and I do the following to solve the issue. Hope this help.

  1. list the authorization account "gcloud auth list"
  2. set the authorization account "gcloud config set account xxxxx"
  3. create the datalab "datalab create xxxx"

Upvotes: 3

Omar Jarjur
Omar Jarjur

Reputation: 1066

I'm not able to reproduce that error in a new project, but here are a couple of things you can try to narrow down the root cause:

  1. Run gcloud auth list and look at what account is listed as "ACTIVE". One potential source of this error is if you have signed in to gcloud with multiple accounts, and the active one is not the owner of the project.
  2. Go to the Cloud Source Repositories page in the cloud console, and see if you can create the repository there. That may give you a more detailed error message.

Upvotes: 3

Related Questions