0
votes

I have created a project (ID: imagetest1-259203) within an organization. I successfully created a repository using

gcloud source repos create repo1

but when I tried to clone this to my PC using

gcloud source repos clone repo1

I get the following issue. (Note: I already have enabled "Cloud Source Repositories API")

Cloning into 'D:\AppEngineTests\repo1'...
remote: PERMISSION_DENIED: The caller does not have permission
remote: [type.googleapis.com/google.rpc.RequestInfo]
remote: request_id: "2e79f3c507f14b3190d7a5941bed3e5f"
fatal: unable to access 'https://source.developers.google.com/p/imagetest1-259203/r/repo1/': The requested URL returned error: 403
ERROR: (gcloud.source.repos.clone) Command '[u'git', u'clone', u'https://source.developers.google.com/p/imagetest1-259203/r/repo1', u'D:\\AppEngineTests\\repo1', u'--config', u'credential.helper=', u'--config', u'credential.helper=!gcloud.cmd auth git-helper [email protected] --ignore-unknown $@']' returned non-zero exit status 128

But when I cloned to Cloud Shell using the same set of commands, it succeeded.

2
The issue was gone, when I used PowerShell (previously used command prompt) and then run 'git config --global http.cookiefile "%USERPROFILE%\.gitcookies" and run 'gcloud source repos clone repo1'. I wonder why it is gone by doing this.Praboda

2 Answers

2
votes

In order to clone the contents of a Google Cloud Repository you need:

  • authentication on your local system

  • a repository in Cloud Source Repositories

  • permissions to interact with the repository link

I suspect you have issues with permissions.

You have to install Cloud SDK.

Provide your authentication credentials:

gcloud init

and then clone the repository:

gcloud source repos clone [REPO_NAME] --project=[PROJECT_NAME]
0
votes

I had this issue for months, I was using two different accounts, personal & work. It worked on one PC, but not another PC.

FIX: Rename or delete this file: %USERPROFILE%_netrc

I tried:

  • gcloud auth revoke + then gcloud auth init
  • Renamed .gitconfig
  • Renamed .gitcookies
  • Deleted %USERPROFILE%\AppData\Roaming\gcloud
  • Deleted creds from Windows Credential Manager with 'git' Eventually ran procmon to trace which files it was reading.
  • Renamed _netrc to _netrc.backup Command then worked. Undid rename and tested again, returned error message once again.