darKoram
darKoram

Reputation: 1143

gcloud init PROJECT error Unable to fetch repository url

I created a project on the gce console called flint.

Then I tried to init the git repo locally following https://cloud.google.com/sdk/gcloud/ in the section Initializing projects and setting up push-to-deploy.

This caused the following error

$ gcloud init flint Initialized gcloud directory in [~/flint/.gcloud]. Unable to fetch repository URL. Guessing the URL, but if your project uses repo-sync then the cloned repository may be read-only. Cloning [https://source.developers.google.com/p/flint/r/default] into [default]. Cloning into '~/flint/default'... fatal: remote error: Repository not found. You may need to create a repository for this project using the Source Code tab at https://console.developers.google.com ERROR: Command '['git', 'clone', 'https://source.developers.google.com/p/flint/r/default', '~/flint/default', '--config', 'credential.helper=gcloud.sh']' returned non-zero exit status 128 ERROR: Unable to initialize project [flint], cleaning up [~/flint]. ERROR: (gcloud.init) Unable to initialize project [flint].

Upvotes: 0

Views: 1397

Answers (3)

Ashish Kumar
Ashish Kumar

Reputation: 581

If you are using correct project id, then probably you are using wrong google account or different project. In order to set up the right account / project, you can use the following commands :

gcloud auth login

You will be redirected to the new page in your browser where you have to select the email address among various other email and allow it.
You will then see the email address you selected and the default project id from that account (which you can change it anytime).

You can also set up your account and project by using the below command :

gcloud init

You will get default configuration along with three choice to change it.
enter image description here

And you can configure it again with require details.

Upvotes: 1

prakashpoudel
prakashpoudel

Reputation: 577

Make sure you are logged in with same email address as of your project associated with gcloud auth login

Upvotes: 0

darKoram
darKoram

Reputation: 1143

The problem here is that the documentation does not distinguish between the project name I chose - "flint" - and the "PROJECT ID" google associates with it. My project id was something akin to potassium-anger-300. You can see this in the table of projects that lists the PROJECT NAME and PROJECT ID as entries in the projects table.

You must use the PROJECT ID for gcloud init.

gcloud init PROJECT ID

The documentation says

gcloud init PROJECT

which is ambiguous between project name and id.

Upvotes: 5

Related Questions