clone a git repo from google cloud platform

Viewed 2746

1) i've created a repo by the web console

2) i've created the ssh keys by putty keygen (RSA 2048bit)

3) private key saved in ./ssh

4) public key pasted on the dedicated section of the GCP (and the key has been correctly accepted)

when try to access the repo (clone) by git clone i get this message:

git clone ssh://xxxxxxxxxxxxxxx@xxxxx.com@source.developers.google.com:2022/p/gcp-team-blue/r/test
Cloning into 'test'...
xxxxxxxxxxxxxxx@xxxxx.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.

pay attention that if i clone the repo by the gcloud utility i can clone it successfully.

Are there other security options that have i set other than ssh keys?

1 Answers

I think the problem is that you have created an ssh key for a user and trying to use another user for the git clone

For example: When you first create the GCP VM it will create two users

  • Normal sudo user [ex. foo]
  • Root user

But when you try to git clone you will try to use sudo by default as the normal user doesn't have enough privileges to make create the directory for the git repo

But the Git service has the normal user [public ssh key]

So the solutions:

  • Create a root user ssh key instead and use it
  • Give the normal user enough permissions to create the dir
Related