I try to clone a repository from gcloud.
Here is my configuration:
$ gcloud info
Google Cloud SDK [183.0.0]
Platform: [Linux, x86_64] ('Linux', 'debian', '4.9.0-4-amd64', '#1 SMP Debian 4.9.65-3 (2017-12-03)', 'x86_64', '')
Python Version: [2.7.13 (default, Nov 24 2017, 17:33:09) [GCC 6.3.0 20170516]]
Python Location: [/usr/bin/python2]
Site Packages: [Disabled]
Installation Root: [/usr/lib/google-cloud-sdk]
Installed Components:
core: [2017.12.08]
app-engine-python: [1.9.64]
beta: [2017.12.08]
gsutil: [4.28]
bq: [2.0.27]
alpha: [2017.12.08]
System PATH: [/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games]
Python PATH: [/usr/bin/../lib/google-cloud-sdk/lib/third_party:/usr/lib/google-cloud-sdk/lib:/usr/lib/python2.7:/usr/lib/python2.7/plat-x86_64-linux-gnu:/usr/lib/python2.7/lib-tk:/usr/lib/python2.7/lib-old:/usr/lib/python2.7/lib-dynload]
Cloud SDK on PATH: [False]
Kubectl on PATH: [/usr/bin/kubectl]
Installation Properties: [/usr/lib/google-cloud-sdk/properties]
User Config Directory: [/home/me/.config/gcloud]
Active Configuration Name: [default]
Active Configuration Path: [/home/me/.config/gcloud/configurations/config_default]
Account: [account@client.com]
Project: [ipcloud-viewer]
Current Properties:
[core]
project: [ipcloud-viewer]
account: [account@client.com]
disable_usage_reporting: [True]
[compute]
region: [europe-west1]
zone: [europe-west1-d]
Logs Directory: [/home/me/.config/gcloud/logs]
Last Log File: [/home/me/.config/gcloud/logs/2017.12.21/11.39.49.435511.log]
git: [git version 2.11.0]
ssh: [OpenSSH_7.4p1 Debian-10+deb9u2, OpenSSL 1.0.2l 25 May 2017]
But when I whant to clone I've got this:
$ gcloud source repos clone repo --project=client_project --account=account@client.com
Clonage dans '/home/me/project/temp/repo'...
fatal: remote error: Access denied to me@other.fr
ERROR: (gcloud.source.repos.clone) Command '['git', 'clone', u'https://source.developers.google.com/p/client_project/r/repo', '/home/me/project/temp/repo', '--config', 'credential.helper=!gcloud auth git-helper --account=account@client.com --ignore-unknown $@']' returned non-zero exit status 128
As you can see, I'm logged with account@client.com
and during the process, the account me@other.fr
is used... and I do not know why !
Any idea what is the problem ?
BTW, I delete my ~/.config/gcloud
and redone a gcloud init
before doing all this....
EDIT: solution founded.
I had a ~/.netrc
file information about mu me@other.fr
account... I removed it and it worked !
The error suggests that the original repository (the one you're trying to clone) has me@other.fr
as owner, but you're trying to access it (via git, under the hood) using the account@client.com
account - the gcloud command executes under a single account.
You could try to add the account@client.com
account as a project member of the original project, allowing it to access that private repository for cloning, see Adding project members and setting permissions .
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.