title: How do I clone a repo from Source Repositories to Compute Engine to pull it manually when needed
body: <p>On my local macOS the following command worked fine:</p>
  
  <pre><code>$ gcloud source repos clone myrepo --project=myproject
  </code></pre>
  
  <p>(though I'm not sure it worked not because previously I followed the <code>~/.gitcookies</code> procedure)</p>
  
  <p>But when I do this on CE:</p>
  
  <pre><code>$ 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 [&lt;digits&gt;-compute@developer.gserviceaccount.com] does not have permission to access project [&lt;myproject&gt;] (or it may not exist): Request had insufficient authentication scopes.
  
  $ gcloud auth list
                    Credentialed Accounts
  ACTIVE  ACCOUNT
  *       &lt;digits&gt;-compute@developer.gserviceaccount.com
  </code></pre>
  
  <p>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.</p>
  
  <p>UPD: also I can't find the <code>.clone</code> role in Roles tab:</p>
  
  <p><a href="https://i.stack.imgur.com/3weOm.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/3weOm.png" alt="enter image description here"></a></p>
  
  <pre><code>$ 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.
  </code></pre>
  
  <p>But it is probably included in <code>.get</code> and so <code>Reader</code> that I already tried:</p>
  
  <p><a href="https://i.stack.imgur.com/IZQ3K.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/IZQ3K.png" alt="enter image description here"></a></p>
  
  <p>UPD2: <code>sudo /usr/local/share/google/google-cloud-sdk/bin/gcloud components update</code> did not help.</p>
  
  <p>The only two options I imagine right now are either edit the</p>
  
  <p><a href="https://i.stack.imgur.com/M1aRs.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/M1aRs.png" alt="enter image description here"></a></p>
  
  <p>(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.</p>
  
  <p>Or forge an another service account but I'm not sure that switching it in <code>gcloud</code> 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?</p>