how do I authenticate with gcloud cmd tool?

1,612 views
Skip to first unread message

Stephen Ubogu

unread,
Sep 16, 2015, 1:19:22 AM9/16/15
to GDG Lagos
Hi all,

I have an application running on GAE and I want to debug it online because it works well on my development server but its buggy on GAE.
I have downloaded the Google cloud SDK but I am having problems authenticating using the following command on the command prompt.

gcloud auth login

This actually opens my browser then prompts me to choose an account to autenticate with.
I tried to authenticate with my gmail which is the admin account for the application.
I granted the permissions requested
but I finally get this error on my command prompt

ERROR: There was a problem with web authentication. Try running again with --no-launch-browser.
ERROR: (gcloud.auth.login) Failed to find "code" in the query parameters of the redirect.

Do i have to authenticate with my service account? how do i get its password?
thanks for prompt reply in advance.


Stephen Ubogu

unread,
Sep 16, 2015, 7:00:05 AM9/16/15
to GDG Lagos
Hello again,
I have been able to authenticate successfully.
clicked on the Add Credentials drop down then selected service accounts.
I created a service account with a JSON key type and it downloaded automatically to my local disk.
From my command prompt I activated my service account using the command

         gcloud auth activate-service-account --key-file KEYFILE    

where KEYFILE points to the JSON file downloaded to my local disk.
then I logged in using the command

         gcloud auth login

My browser was opened and I was prompted to select an account for log in.
I logged in with my regular gmail account which is the admin account for the project.
and Viola!! login was successful.

Nonetheless, I got stuck again while trying to initialize my project.
I tried using this command 

       gcloud init my-project-id

but got 

WARNING: `gcloud init` will be changing very soon and will be incompatible with
old usage. To clone project git repositories use `gcloud beta source repos clone
` command.
Initialized gcloud directory in [d:\p12\my-project-id\.gcloud].
Cloning [https://source.developers.google.com/p/my-project-id/r/default] into [
default].
ERROR: Unable to initialize project [my-project], cleaning up [d:\p12\my-project-id].
ERROR: (gcloud.init) Cannot find git. Please install git and try again.

You can find git installers at [http://git-scm.com/downloads], or use
your favorite package manager to install it on your computer.

i tried gain with this command

       gcloud beta source repos clone default .

where default is a folder in the current directory and I assumed . is the current directory
but got a long error message ending with
 
      WindowsError: [Error 2] The system cannot find the file specified

Please, what am I doing wrong?

Femi TAIWO

unread,
Sep 16, 2015, 7:24:18 AM9/16/15
to lagos...@googlegroups.com
Hi Stephen,

I have been using GAE for a bit and think I can help.

Are you trying to deploy the project from your local machine to app engine online ? Is that the desired goal? If yes, then I recommend that you download the App Engine SDK https://cloud.google.com/appengine/downloads. It features a GUI that's way easier  to use, so there's no need to use the command line for the most common tasks.

However, if you are trying to connect your local repository of your project so that once you push to your master branch (on GIT), it automatically updates the server online, then take a look at this page : https://cloud.google.com/sdk/gcloud/reference/init


--
-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_
 
[ Quicklinks ]
Join on G+: http://goo.gl/wKOuQ
Mailing List:http://bit.ly/lagosgtuggroup
Unsubscribe: http://goo.gl/0y8TB
Blog: http://gdglagos.com
Twitter Handle: http://twitter.com/@gtuglagos
 
---_---_---_---_---_---_---_---_---_---_---_---_---_---_---
---
You received this message because you are subscribed to the Google Groups "GDG Lagos" group.
To unsubscribe from this group and stop receiving emails from it, send an email to lagos-gtug+...@googlegroups.com.
To post to this group, send email to lagos...@googlegroups.com.
Visit this group at http://groups.google.com/group/lagos-gtug.
For more options, visit https://groups.google.com/d/optout.

Stephen Ubogu

unread,
Sep 18, 2015, 2:12:47 AM9/18/15
to lagos...@googlegroups.com

Thanks for the link.

I have been able to execute the command "gcloud init my-project" without errors,

I had to download and install git.

however, executing the command created two folders in the current directory

one named .gcloud containing a file named properties

and the other is empty and named default. (specification says this is my new local repository but i wonder why its empty).

th   the next step is to commit my code to my local repository then push it to my cloud repository,

      but I can't figure out what its means to commit my code to my local repository.
      
      thanks once again in advance.







You received this message because you are subscribed to a topic in the Google Groups "GDG Lagos" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/lagos-gtug/rN2rPSP_aLM/unsubscribe.
To unsubscribe from this group and all its topics, send an email to lagos-gtug+...@googlegroups.com.

To post to this group, send email to lagos...@googlegroups.com.
Visit this group at http://groups.google.com/group/lagos-gtug.
For more options, visit https://groups.google.com/d/optout.



--
Stephen Ubogu

Frank Chukwuelue

unread,
Sep 18, 2015, 2:18:47 AM9/18/15
to GDG Lagos
Hi Stephen,

Its great to know that you have been able to work without errors now.

From all indications you are now working with Git and its a good tool. 

People have a feeling that Git is difficult to use but truly its not. Committing, adding, removing, pushing and all can be done from the command line without hassles. Take a look at this link below and get a head start.


Cheers 



Frank Chukwuelue
Technology Evangelist
Reply all
Reply to author
Forward
0 new messages