在我的本地 macOS 上,以下命令运行良好:
$ gcloud source repos clone myrepo --project=myproject
(虽然我不确定它是否有效,因为之前我遵循了该~/.gitcookies
程序)
但是当我在 CE 上这样做时:
$ gcloud source repos clone myrepo --project=myproject
ERROR: (gcloud.source.repos.clone) PERMISSION_DENIED: Request had insufficient authentication scopes.
$ gcloud source repos list
ERROR: (gcloud.source.repos.list) User [<digits>-compute@developer.gserviceaccount.com] does not have permission to access project [<myproject>] (or it may not exist): Request had insufficient authentication scopes.
$ gcloud auth list
Credentialed Accounts
ACTIVE ACCOUNT
* <digits>-compute@developer.gserviceaccount.com
在 IAM 选项卡中,我看到此服务帐户具有“对所有资源的编辑权限”,但它没有帮助。即使我添加角色源存储库读+写。
UPD:我也找不到.clone
角色选项卡中的角色:
$ gcloud help source repos
COMMANDS
COMMAND is one of the following:
clone
Clone a cloud source repository.
create
Create a cloud source repository.
delete
Delete a cloud source repository.
describe
Describe a cloud source repository.
get-iam-policy
Get the IAM policy for the named cloud source repository.
list
List the repositories the currently active project.
set-iam-policy
Set the IAM policy for the named repository.
但它可能包含在.get
,所以Reader
我已经尝试过:
UPD2:sudo /usr/local/share/google/google-cloud-sdk/bin/gcloud components update
没有帮助。
我现在想象的唯一两个选择是编辑
(这是我在互联网上发现的唯一一个似乎是解决方案的东西,但该博客文章是用某种东方语言编写的,所以我不确定)但它需要 VM 停止,这是不可接受的。
或者伪造另一个服务帐户,但我不确定在gcloud
CLI 中切换它不会破坏该机器上运行的其他应用程序。或者也许我在克隆 repo 时只能使用它一次,它会坚持下去?