Search code examples
gitsshgoogle-cloud-repository

Trying to clone repo from Google Cloud Source Repositories using SSH authentication


I am trying to clone an empty repository from the Google Cloud Resource Repositories. So far I have:

  • Created an empty repository on Google Cloud Source Repositories.
  • Generated an ssh key (default name "id_rsa") from my local machine (Windows 10).
  • Registered the contents of the public key (id_rsa.pub) in the Register SSH Key section of Cloud Source Repositories.
  • Opened Git Bash and run git clone ssh://[email protected]@source.developers.google.com:2022/p/some-project/r/some-repository

However, it fails with this response:

Cloning into 'some-repository'...
Enter passphrase for key '/c/Users/blah/.ssh/id_rsa':
fatal: could not fetch refs from ssh://[email protected]@source.developers.google.com:2022/p/some-project/r/some-repository

I am running Git Bash from Windows 10

It does label SSH Authentication as BETA on Cloud Resource Repositories, which makes me wonder if it might not be fully functional yet.
Has anyone managed to connect to Cloud Resource Repositories via SSH?

Any help or advice much appreciated. Thank you


Solution

  • Try first to use an SSH key without passphrase, and make sure to create it with the legacy format:

    ssh-keygen -m PEM -t rsa -P ""
    

    (The -m PEM is for producing the legacy format)

    That will overwrite your previous key: register the new id_rsa.pub content, and try again.