0
votes

Our team have a git repository on gitlab. I have an account there. I've created ssh keys on the one computer. Now I want to clone that repo to another machine. In my account I can see my public key at the "SSH Keys" section, also I can see my private token in "Account" section. At first I wanted to use existing key with smartgit, it did`t work then I created new keys, add that new public key to my account and tried to clone from git bash like this:

git clone  [email protected]:bla/bla.git

But it gives me

Cloning into 'bla'...
Permission denied (publickey).
fatal: Could not read from remote repository.

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

I even tried to copy public key from my GitLab account directly to the id_rsa.pub file.

So how can I get that repository cloned?

Edited

Last lines from ssh -vvv [email protected]

debug3: send packet: type 5
debug3: receive packet: type 6
debug2: service_accept: ssh-userauth
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug3: send packet: type 50
debug3: receive packet: type 51
debug1: Authentications that can continue: publickey
debug3: start over, passed a different list publickey
debug3: preferred publickey,keyboard-interactive,password
debug3: authmethod_lookup publickey
debug3: remaining preferred: keyboard-interactive,password
debug3: authmethod_is_enabled publickey
debug1: Next authentication method: publickey
debug1: Offering RSA public key: /c/Users/Arthur/.ssh/id_rsa
debug3: send_pubkey_test
debug3: send packet: type 50
debug2: we sent a publickey packet, wait for reply
debug3: receive packet: type 51
debug1: Authentications that can continue: publickey
debug1: Trying private key: /c/Users/Arthur/.ssh/id_dsa
debug3: no such identity: /c/Users/Arthur/.ssh/id_dsa: No such file or directory
debug1: Trying private key: /c/Users/Arthur/.ssh/id_ecdsa
debug3: no such identity: /c/Users/Arthur/.ssh/id_ecdsa: No such file or directo                     ry
debug1: Trying private key: /c/Users/Arthur/.ssh/id_ed25519
debug3: no such identity: /c/Users/Arthur/.ssh/id_ed25519: No such file or direc                     tory
debug2: we did not send a packet, disable method
debug1: No more authentication methods to try.
Permission denied (publickey).
1
"I even tried to copy public key from my GitLab account directly to the id_rsa.pub file.". That is very bad idea. Do it the other way round. On your computer, you need the private key. Post the log from ssh -vvv [email protected]Jakuje
Git bash might not be adding the private key to your SSH agentLuke
Edited a post with log. So how can I add it manually?Arthur Kishinets

1 Answers

3
votes

Go Clean Slate. Create a new key and work over it.

  1. By running, ssh-keygen and provide it with a keyname.

  2. Copy the keyname.pub and paste in your keys in gitlab account.

  3. Clear any residual keys already existing in your system, ssh-add -D

  4. Add the key you just created by ssh-add <path_to_key>/keyname

Now, try again git commands.