3

I'm setting up Git Bash on my Windows 10 PC with the intent of using it with Gitlab. Despite setting everything up correctly, a git clone or git push always results in Permission denied (publickey).

Before you say it, I've looked extensively at all answers to similar problems, and on top of that, I'm fairly experienced with this sort of thing.

So, yes, I've generated brand-spanking new SSH key pairs, sitting happily in ~/.ssh/ as id_rsa and id_rsa.pub. The public key is registered to my account in Gitlab, which is the master of the repository, and the repository exists and has been initialized.

On top of everything else, I've done what the Gitlab documentation says and have tested my setup using

ssh -T git@gitlab.com

and got the anticipated "Welcome to GitLab, [Given Name]!" message, meaning the SSH key is working (otherwise, you'd see the permission denied publickey message).

Regardless, any attempt to interact with the actual server results in:

Permission denied (publickey).

fatal: Could not read from remote repository.

Does anyone have any experience with this same issue, or ideas of other things to try? Most people's issues seem to usually be resolved with a new key pair, or something simple like that.

Thanks in advance!

Community
  • 1
  • 1
3nails4you
  • 112
  • 1
  • 9

1 Answers1

2

Make sure you don't have an environment variable GIT_SSH referencing putty.

And, to debug, set in your bash session:

export GIT_SSH_COMMAND='ssh -Tv'

That way, you will see exactly what Git is trying to access when using ssh during a git clone.

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • Thanks for the tip on the debug statement. It's still not giving me much - it's using OpenSSH and OpenSSL, and still just giving me this: – 3nails4you Aug 02 '17 at 14:24
  • debug1: Authentications that can continue: publickey debug1: Next authentication method: publickey debug1: Offering RSA public key: /c/Users/username/.ssh/id_rsa debug1: Authentications that can continue: publickey debug1: Trying private key: /c/Users/username/.ssh/id_dsa debug1: Trying private key: /c/Users/username/.ssh/id_ecdsa debug1: Trying private key: /c/Users/username/.ssh/id_ed25519 debug1: No more authentication methods to try. Permission denied (publickey). It is making me think, though, about making sure my ssh_config is properly set up. Sorry about the formatting! – 3nails4you Aug 02 '17 at 14:24
  • Have you found a solution? I´m having the same problems. I have set puplic keys in many different ways. – Thadeu Melo Jul 11 '18 at 12:42
  • @ThadeuAntonioFerreiraMelo `ssh -T git@gitlab.com` is working? Do you have a %USERPROFILE%\.ssh\config file? – VonC Jul 11 '18 at 12:44
  • @VonC I just figured out what was wrong with my keys. I was naming them. When ssh-keygen prompts to give a name wou should only press Enter. I also need to be inside the .ssh directory. Thanks – Thadeu Melo Jul 11 '18 at 13:00