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.
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).