Maximilian
Maximilian

Reputation: 8520

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

Upvotes: 7

Views: 8851

Answers (2)

Robert
Robert

Reputation: 296

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

Upvotes: 12

cherba
cherba

Reputation: 8980

You need to set credential helper for Google Cloud repository only, not system wide.

Also for github consider using ssh-keys instead of username/password: https://help.github.com/articles/connecting-to-github-with-ssh/

Upvotes: 0

Related Questions