2

I am using a Google Compute Engine Instance which has external IP address disabled and is accessing the internet through Cloud NAT. The problem is that when I am trying to clone a Repo from Google Cloud Source Repo using SSH Authentication, I am getting the following error:-

Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

I setup Cloud NAT in GCE using this example. The GCE is able to access the internet as I installed a few packages. I am using the RSA key for authentication and followed the instructions provided here.

How can I solve this problem? I don't want to use manual credentials or Cloud SDK for cloning the Repo.

2 Answers2

1

It's not a Compute Engine or NAT issue (or network), it's simply a GIT issue. Your client is not authorized on your repository

For this, you can rely on this authentication page.

My guess is that the compute engine service account is not authorized to access to Cloud Repository. Check the Cloud Repository permissions in the setting page (gear in the top right corner of Cloud Repository).

guillaume blaquiere
  • 66,369
  • 2
  • 47
  • 76
  • Thanks for your answer. But I am already using SSH authentication, as I stated in the question above. But still, the error is persisting. – Arjun Sehajpal Jun 22 '20 at 04:41
0

The message is somewhat self-explanatory

Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

You must have the appropriate credentials as @guillaume mentioned, you must either not have your public SSH key here or the private key is missing from your GCE instance or not being correctly referenced by your git.

A way to confirm this would be to give your current GCE instance an external IP in order to bypass Cloud NAT.

Frank
  • 525
  • 2
  • 8