3

When I try to git push to Google cloud repository, I get the above message. It then asks me to enter my credentials. After that I get the following error:

Valid choices are [auth, components, compute, config, container, deployment-manager, dns, docker, feedback, help, info, init, meta, preview, projects, source, sql, topic, version]. fatal: Authentication failed for 'https://source.developers.google.com/p/projectname/'

Is there anything am missing?

Stephen Weinberg
  • 51,320
  • 14
  • 134
  • 113
kassold
  • 469
  • 3
  • 8
  • 21
  • Does `git config --list` show anything out of the ordinary? – Valentin Feb 14 '16 at 00:33
  • Am not very familiar with git, but this is the output for `git config --list`: core.repositoryformatversion=0 core.filemode=true core.bare=false core.logallrefupdates=true credential.helper=/opt/google-cloud-sdk/bin/gcloud remote.google.url=https://source.developers.google.com/p/projectid/ remote.google.fetch=+refs/heads/*:refs/remotes/google/* remote.bitbucket.url=https://username:password@bitbucket.org/username/reponame.git remote.bitbucket.fetch=+refs/heads/*:refs/remotes/bitbucket/* – kassold Feb 14 '16 at 18:10

2 Answers2

5

As git config --list shows in your setup, git credential helper points to

credential.helper=/opt/google-cloud-sdk/bin/gcloud

This appears to be incorrect. The helper should not include absolute path. You can reset it to correct value by running

$ git config credential.helper gcloud.sh

For the above to work gcloud MUST be in your PATH environment variable, as otherwise git will not be able to find git-credential-gcloud.sh. Make sure

$ which git-credential-gcloud.sh

returns path where it is located. If it does not you can run to set path

$ source /opt/google-cloud-sdk/path.bash.inc
cherba
  • 8,681
  • 3
  • 27
  • 34
1

Try this instead:

Go to :

https://console.developers.google.com/project/your-project-id > 
Source Code > 
Browse > 
Find this line : 

Alternatively, instead of using the Google Cloud SDK to manage your authentication, you can manually generate your Git credentials by following this link...

Click "following this link" and you can see your git password.

  • Use your gmail and git password above to clone repository.
  • Or create .netrc file at your home folder and add :

machine source.developers.google.com
login your-email@gmail.com
password ...

It will not request your password again.

Community
  • 1
  • 1
CodeWizard
  • 128,036
  • 21
  • 144
  • 167
  • 1
    I'm sorry, am unable to see the text you referenced. When I go here `https://console.developers.google.com/code/develop/browse?project=projectid`, I only see brief descriptions (ie use private Git hosting, access easy tools to understand your code etc). But I don't see the text you quoted. On the left panel I see "Source Code" , "Repository Settings" and "Tools and Plugins". – kassold Feb 14 '16 at 22:37
  • 1
    @cherba's answer fixed my issue. I upvoted this one too though. – kassold Feb 14 '16 at 23:40