问题
When I try to git push
to Google cloud repository, I get the above message.
It then asks me to enter my credentials. After that I get the following error:
Valid choices are [auth, components, compute, config, container, deployment-manager, dns, docker, feedback, help, info, init, meta, preview, projects, source, sql, topic, version]. fatal: Authentication failed for 'https://source.developers.google.com/p/projectname/'
Is there anything am missing?
回答1:
As git config --list
shows in your setup, git credential helper points to
credential.helper=/opt/google-cloud-sdk/bin/gcloud
This appears to be incorrect. The helper should not include absolute path. You can reset it to correct value by running
$ git config credential.helper gcloud.sh
For the above to work gcloud
MUST be in your PATH environment variable, as otherwise git will not be able to find git-credential-gcloud.sh
. Make sure
$ which git-credential-gcloud.sh
returns path where it is located. If it does not you can run to set path
$ source /opt/google-cloud-sdk/path.bash.inc
回答2:
Try this instead:
Go to :
https://console.developers.google.com/project/your-project-id >
Source Code >
Browse >
Find this line :
Alternatively, instead of using the Google Cloud SDK to manage your authentication, you can manually generate your Git credentials by following this link...
Click "following this link" and you can see your git password.
- Use your gmail and git password above to clone repository.
- Or create
.netrc
file at your home folder and add :
machine source.developers.google.com
loginyour-email@gmail.com
password...
It will not request your password again.
来源:https://stackoverflow.com/questions/35386178/what-causes-google-gcloud-error-message-error-gcloud-invalid-choice-get