Gcloud克隆不使用正确的帐户

时间:2017-12-21 10:59:26

标签: linux git google-cloud-platform

我尝试从gcloud克隆存储库。

这是我的配置:

$ 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]

但是当我想要克隆时,我已经得到了这个:

$ 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

正如您所看到的,我已使用account@client.com进行了记录,并且在此过程中使用了帐户me@other.fr ......我不知道为什么!

知道这是什么问题吗?

顺便说一句,我删除了~/.config/gcloud并重做了gcloud init,然后才做完这一切....

编辑:解决方案成立。

我有关于mu ~/.netrc帐户的me@other.fr个文件信息...我将其删除并且有效!

1 个答案:

答案 0 :(得分:0)

该错误表明原始存储库(您尝试克隆的存储库)具有me@other.fr作为所有者,但您尝试使用{{1来访问它(通过git,引擎盖下)帐户 - gcloud命令在单个帐户下执行。

您可以尝试将account@client.com帐户添加为原始项目的项目成员,允许其访问该私有存储库进行克隆,请参阅Adding project members and setting permissions