On my local macOS the following command worked fine:
$ gcloud source repos clone myrepo --project=myproject
(though I'm not sure it worked not because previously I followed the ~/.gitcookies
procedure)
But when I do this on 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
In IAM tab I see this service account has the "Editor access to all resources" but it does not help. Even if I add roles Source Repository Read+Write.
UPD: also I can't find the .clone
role in Roles tab:
$ 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.
But it is probably included in .get
and so Reader
that I already tried:
UPD2: sudo /usr/local/share/google/google-cloud-sdk/bin/gcloud components update
did not help.
The only two options I imagine right now are either edit the
(it is the only thing I've found in Internet that seems to be a solution but that blog post is written in some eastern language so I'm not sure) but it would need the VM stop that is not acceptable.
Or forge an another service account but I'm not sure that switching it in gcloud
CLI won't break other applications running on that machine. Or maybe I can use it only once when cloning the repo and it will stick with it?