3

I am attempting a push of the an Eclipse project's local Git repository into a Google Cloud Repository for the first time.

To this end I select Team | Push Branch 'master' from my Eclipse (Mars) project's context menu in the Eclipse Project Explorer and then provide the following information:

  • Remote name: google
  • URI: https://source.developers.google.com/p/<x>/ where x is the name of my Google Cloud Platform project
  • User: my Google account name of the form <y>@gmail.com, i.e. a valid e-mail address
  • Password: my Google account password

Next, I am presented twice with a further dialog box that again asks for credentials for the repository at https://source.developers.google.com/p/<x>/ (as if the first one would have been rejected, but why?) and I provide the same credentials (User, Password) two more times.

At this point, I run into this error message:

Can´t connect to any URI: https://source.developers.google.com/p/<x>/   
(https://source.developers.google.com/p/<x>/ not authorized)

What could be wrong? Am I supposed to use another credential than the (global) one for my Google Account when pushing to a Google Cloud Repository (as would seem wise from a security perspective), and if so, how could I obtain one? Overall, what is the right recipe for executing this kind of push from inside Eclipse as opposed to on a command-line?

Drux
  • 11,992
  • 13
  • 66
  • 116

1 Answers1

1

I ended up doing it from the command line after all:

cd <local-git-repository>
# pwd contains .git; try git status
# gcloud init was already run
git config credential.helper gcloud.sh
git remote add google https://source.developers.google.com/p/<x>/

This includes the following effects:

  1. Source code now visible inside Google Cloud Repository e.g. from Google Developers Console
  2. Remote Git repository now visible inside Eclipse (Mars) as configured remote repository google: https://source.developers.google.com/p/<x>/
Drux
  • 11,992
  • 13
  • 66
  • 116
  • I did the same, but each time I try to push to the repository through the IDE it always asks for credentials. Push works only through command line. Any help? – natario Feb 29 '16 at 13:44
  • 1
    It looks like the Eclipse Git plugin (EGit) [only uses JGit](http://stackoverflow.com/a/29139348/3953357), which currently isn't supported with credential.helper. – Adam Oct 14 '16 at 21:23
  • The GCP doesn't accept usernames/passwords to authenticate. It requires access tokens that the credential helper will pass to the GCP. – Johann Nov 13 '16 at 13:22