简体   繁体   中英

Pushing local Git repository to remote Google Cloud Repository from inside Eclipse?

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 , ie 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 ?

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 eg 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>/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM