Cannot post existing git repo to Google Source

6,429 views
Skip to first unread message

ycaille

unread,
Jul 21, 2015, 7:54:29 AM7/21/15
to google-c...@googlegroups.com
Hi,

I've just discovered Google Source repository and tried to use it to host one of my repo.
Alas, it just doesn't work at all.

I followed all the steps mentionned in
https://console.developers.google.com/project/MY-PROJECT/clouddev/develop/repo?authuser=2
in section [Push code from a local Git repository to your Cloud Repository], but it fails in step #4 with the following message

$ git push --all google
git
: 'credential-gcloud.sh' is not a git command. See 'git --help'.
Username for 'https://source.developers.google.com':

Any idea what goes wrong here ?
If I try to bypass the authentication issue by feeding a username/password for my Google account, it doesn't work either.

Best regards,
Yannick.


Arthur Cherba

unread,
Jul 21, 2015, 9:53:13 AM7/21/15
to google-c...@googlegroups.com
Hello,
  I assume you are following these instructions
  1. 1. Install Google Cloud SDK
  2. 2. Use the following commands to authenticate:
    gcloud auth login
    git config credential.helper gcloud.sh
  3. 3. Add your Cloud Repository as a remote:git remote add google https://source.developers.google.com/p/MY-PROJECT/
  4. 4. Push from your local Git repository:git push --all google
During installation of Cloud SDK did you choose to update .bashrc to include your path and sourced it.
If you type
  $ which git-credential-gcloud.sh
or
  # which gcloud

do you get back result. Note that gcloud bin directory must be in your path for this to work, you can do it for example by
 $ source GCLOUD_INSTALATION_DIR/google-cloud-sdk/path.bash.inc

--Arthur

ycaille

unread,
Jul 21, 2015, 10:09:23 AM7/21/15
to google-c...@googlegroups.com
Thanks a lot Arthur. That fixed my problem !

I'd indeed included the 2 files completion.bash.inc and path.bash.inc in my .bashrc but for some weird reason, the later wasn't picked up properly, resulting in git-credential-gcloud.sh not present in my $PATH.

After fixing that part, I could successfully push my repo.

Best regards,
Yannick.

oscar6echo

unread,
Feb 27, 2016, 8:49:58 PM2/27/16
to google-cloud-sdk
As of today, on OSX El Yosemite, if you have install gcloud through brew cask (conveniently), when you want to push a local git repo to google cloud source repo (for example to use console debugging) you must type the following:

1/
'gcloud init'
presumably to change you default project to the current one, maybe other params too

2/
'git config credential.helper gcloud'
Do NOT use .sh (BEWARE: the online help is wrong when it says gcloud.sh)
Ultimately the gcloud sdk installation points to youinstalldir/google-cloud-sdk/latest/google-cloud-sdk/bin/git-credential-gcloud.sh.
But the 'git config credential.helper' command needs only this part of the full file name.
'which git-credential-gcloud' must display the path to the file, in my case: /usr/local/bin/git-credential-gcloud
And 'ls -al /usr/local/bin/git-credential-gcloud' will show where the link goes, in my case: /usr/local/bin/git-credential-gcloud -> /opt/homebrew-cask/Caskroom/google-cloud-sdk/latest/google-cloud-sdk/bin/git-credential-gcloud.sh

3/
This is given by google on the cloud console
git push google master
(you must have a repo with at least one commit for it to work)

4/
to check the repo config:
'git config --local -l'
or simply open the .git/config text file

Check also the difference with you global config
'git config --global -l'
particularly to see you usual credential.helper (maybe osxkeychain if you use githug) is not impacted by this repo local config.



It took some time to figure all this. So I thought it might help people.

Thx

Arthur Cherba

unread,
Feb 28, 2016, 9:38:13 AM2/28/16
to google-cloud-sdk
Thanks for sharing your experience with Google Cloud repositories. This is very helpful.

gcloud tool has command [gcloud source repos clone --project my_project], which does most of the steps you describe.
I suppose your scenario is different as you are adding git remote to an existing repository. Perhaps gcloud should have command for that.

Do NOT use .sh (BEWARE: the online help is wrong when it says gcloud.sh)

Actually it has to be gcloud.sh (if installed via official/recommended channel https://cloud.google.com/sdk/#mac), it is an more an issue with brew.
Reply all
Reply to author
Forward
0 new messages