Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using gcloud's credential helper to access Google Source Repositories prevents osxkeychain from working

In the Google Source Repositories docs, it asks you to use git config credential.helper gcloud.sh to allow Git to authenticate

Recently, that's prevented me from using osxkeychain auth with GitHub - after adding that command, I get this error message when I attempt to pull from GitHub (on a repo whose only remotes are GitHub remotes):

git pull 

remote: Invalid username or password.
fatal: Authentication failed for 'https://github.com/[].git/'

Note that it doesn't even ask for my username & password again; it immediately refuses to connect

If I remove the gcloud credential.helper from git config, I can re-authenticate with GitHub (though need to type my username & password in again)

I'm using git version 2.15.1 and gcloud:

Google Cloud SDK 183.0.0
alpha 2017.09.15
beta 2017.09.15
bq 2.0.27
container-builder-local
core 2017.12.08
datalab 20171003
gcloud
gsutil 4.28
kubectl
like image 408
Maximilian Avatar asked Dec 24 '22 11:12

Maximilian


1 Answers

The problem here is that the instructions overwrite a possible existing credential helper. To restrict the credential helper to only apply to Google Source Repositories run:

git config credential.'https://source.developers.google.com'.helper gcloud.sh

or change in your .git/config

[credential]
        helper = gcloud.sh

to

[credential "https://source.developers.google.com"]
        helper = gcloud.sh
like image 72
Robert Avatar answered Dec 26 '22 09:12

Robert