I've been using Google source repos for many years, and now I'm getting permission denied when I try to push or pull.
I've checked everything I can think of:
- Updated gcloud:
gcloud components update
- Reinitialized:
gcloud init
- Reinstalled gcloud tools
- Updated git
- Cloned repo to new directory (no permission)
- I still have access on the console: https://source.cloud.google.com/project/default
- Closed and reopened terminal
- I'm the owner of the organization and the project but I also added all source repository permissions
The above process sets my account and project so those are all set.
I just tried on a different computer (Windows 10), and I don't get permission denied. The issue has something to do with my Mac setup...
Below are some examples:
$ git pull
remote: PERMISSION_DENIED: The caller does not have permission
remote: [type.googleapis.com/google.rpc.RequestInfo]
remote: request_id: "xxx"
fatal: unable to access 'https://source.developers.google.com/p/project/r/default/': The requested URL returned error: 403
$ gcloud source repos clone default --project=project
Cloning into '/Users/user/TMP/default'...
remote: PERMISSION_DENIED: The caller does not have permission
remote: [type.googleapis.com/google.rpc.RequestInfo]
remote: request_id: "xxx"
fatal: unable to access 'https://source.developers.google.com/p/project/r/default/': The requested URL returned error: 403
ERROR: (gcloud.source.repos.clone) Command '['git', 'clone', 'https://source.developers.google.com/p/project/r/default', '/Users/user/TMP/default', '--config', 'credential.https://source.developers.google.com/.helper=', '--config', 'credential.https://source.developers.google.com/.helper=!gcloud auth git-helper --account=me@example.com --ignore-unknown $@']' returned non-zero exit status 128.
$ git clone ssh://me@example.com@source.developers.google.com:2022/p/project/r/default
Cloning into 'default'...
me@example.com@source.developers.google.com: Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.