rapsli
rapsli

Reputation: 799

Issues with authentication again GCP Source Repository with publickey

I had to do a blank install and with that setup new private key. I have created it according to https://cloud.google.com/source-repositories/docs/authentication.

[email protected]@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.

I have tried multiple times following the docs. Always the same. I have installed the same public key with bitbucket and tried cloning a repo. Worked like a charm. So the key must be setup correctly.

I have run ssh -vT [email protected]@source.developers.google.com -p2022

Which outputs:

OpenSSH_for_Windows_8.1p1, LibreSSL 3.0.2
debug1: Connecting to source.developers.google.com [108.177.127.82] port 2022.
debug1: Connection established.
debug1: identity file C:\\Users\\schae/.ssh/id_rsa type 0
debug1: identity file C:\\Users\\schae/.ssh/id_rsa-cert type -1
debug1: identity file C:\\Users\\schae/.ssh/id_dsa type -1
debug1: identity file C:\\Users\\schae/.ssh/id_dsa-cert type -1
debug1: identity file C:\\Users\\schae/.ssh/id_ecdsa type -1
debug1: identity file C:\\Users\\schae/.ssh/id_ecdsa-cert type -1
debug1: identity file C:\\Users\\schae/.ssh/id_ed25519 type -1
debug1: identity file C:\\Users\\schae/.ssh/id_ed25519-cert type -1
debug1: identity file C:\\Users\\schae/.ssh/id_xmss type -1
debug1: identity file C:\\Users\\schae/.ssh/id_xmss-cert type -1
debug1: Local version string SSH-2.0-OpenSSH_for_Windows_8.1
debug1: Remote protocol version 2.0, remote software version Go
debug1: no match: Go
debug1: Authenticating to source.developers.google.com:2022 as '[email protected]'
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: algorithm: [email protected]
debug1: kex: host key algorithm: ecdsa-sha2-nistp256
debug1: kex: server->client cipher: [email protected] MAC: <implicit> compression: none
debug1: kex: client->server cipher: [email protected] MAC: <implicit> compression: none
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: Server host key: ecdsa-sha2-nistp256 SHA256:AGvEpqYNMqsRNIviwyk4J4HM0lEylomDBKOWZsBn434
debug1: Host '[source.developers.google.com]:2022' is known and matches the ECDSA host key.
debug1: Found key in C:\\Users\\schae/.ssh/known_hosts:1
debug1: rekey out after 134217728 blocks
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: rekey in after 134217728 blocks
debug1: pubkey_prepare: ssh_get_authentication_socket: No such file or directory
debug1: Will attempt key: C:\\Users\\schae/.ssh/id_rsa RSA SHA256:tV/7LTCWmmg0nL2v0iy5D9/zyyLm4C4wykndp764WlI
debug1: Will attempt key: C:\\Users\\schae/.ssh/id_dsa
debug1: Will attempt key: C:\\Users\\schae/.ssh/id_ecdsa
debug1: Will attempt key: C:\\Users\\schae/.ssh/id_ed25519
debug1: Will attempt key: C:\\Users\\schae/.ssh/id_xmss
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey
debug1: Next authentication method: publickey
debug1: Offering public key: C:\\Users\\schae/.ssh/id_rsa RSA SHA256:tV/7LTCWmmg0nL2v0iy5D9/zyyLm4C4wykndp764WlI
debug1: Server accepts key: C:\\Users\\schae/.ssh/id_rsa RSA SHA256:tV/7LTCWmmg0nL2v0iy5D9/zyyLm4C4wykndp764WlI
debug1: Authentication succeeded (publickey).
Authenticated to source.developers.google.com ([108.177.127.82]:2022).
debug1: channel 0: new [client-session]
debug1: Entering interactive session.
debug1: pledge: network
shell request failed on channel 0

In the last lines it says something like: "Authentication succeeded". So I guess with the key everything should be ok. BUT I can't clone the repository. What I'm I missing?????

Update 29.10.2021

That Google user has the following permissions: source.repos.create, source.repos.get,source.repos.list,source.repos.update (and actually even more) and yes the user is also "Source Repository Administrator"

Any maybe one more thing: Everything worked flawlessly until I had to reinstall the local computer and setup everything again. For the past year or so there have been no issues. After the reinstall all I did was setting up a new private/public key and installed the public key here https://source.cloud.google.com/user/ssh_keys I wouldn't know what else there is to do?

I did some more experiments. I have no removed public and private key from .ssh folder. I have removed all public keys from GCP and Bitbucket. With both I get the same error (obviously). I have then added the key to bitbucket -> works just fine. I have then added the key to GCP and tried to clone a repo -> no success. Permission denied.

That debug info seems strange? What does it mean?

shell request failed on channel 0

Upvotes: 2

Views: 292

Answers (1)

rapsli
rapsli

Reputation: 799

changed the key_type to ecdsa and that worked. It was probably some kind of caching or some key that was stuck somewhere.

Upvotes: 1

Related Questions