1

Currently I am facing a problem with git clone a repo using SSH. I had set up my SSH Key and inserted it into GitLab. However still it does not work out.

Permission denied as like below: enter image description here

And another problem is the fingerprint generated above is different from the one that is generated in Gitlab as shown below: enter image description here

Hope if anyone could help. Had been troubleshooting this for a few days.

I tried to delete the .ssh folder and regenerate new key and did everything the same again but turn out to be the same, Permission denied and fingerprint is never matching.

I am using OpenSSH and OS: Windows 11 for this problem. I had also tried ssh -Tvvv <username@server> , ssh <username@server>, ssh -Tv <username@server> to verify whether if I am connected but the same permission denied.

  • 1
    I believe you are mistaking fingerprint of your SSH key for authenticating (that's what the Gitlab shows) and the fingerprint of the Gitlab server's hostkey (that's the console output shows). => Though that does not explain why you cannot authenticate. Just do not get misled by the fingerprints. + Please, post the console output as a text, not as an image. – Martin Prikryl Feb 18 '23 at 19:53

1 Answers1

1

As commented, the server fingerprint (for the ~/.ssh/known_hosts) differs from the public key fingerprint.

For the latter, test it with ssh -Tv git@gitlab.com, and check your private key is used.

If your private key does not have a default name (like id_rsa), you would need a ~/.ssh/config to reference your key.

Host gl
  Hostname gitlab.com
  User git
  IdentityFile ~/.ssh/myKey

And ssh -Tv gl for testing.

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • Hi @VonC I have followed your steps and there is a whole output on the console. It seems fine but there is an output that I find weird `debug1: Reading configuration data C:\\Users\\yapch/.ssh/config` `debug1: Authenticator provider $SSH_SK_PROVIDER did not resolve; disabling` Still I can't clone the repo using ssh because of Permission Denied. Hope you could help. Thank youu – Yap Wei Cheng Feb 20 '23 at 06:26
  • @YapWeiCheng Try and *not* use OpenSSH, but the SSH packaged with Git for Windows. Set your PATH in a CMD (for testing) as [I suggest here](https://stackoverflow.com/a/75433297/6309) and see if it works better. Are you behind a VPN? Are you using a proxy? – VonC Feb 20 '23 at 06:52
  • Okay i will avoid using OpenSSH. Yes I am using a VPN to connect to the Gitlab server. Do I need to configure the VPN of something? – Yap Wei Cheng Feb 20 '23 at 07:30
  • @YapWeiCheng I my experience, egress SSH connection is not always allowed through VPN. I am using a VPN and only uses HTTPS URL for GitLab, because SSH is blocked. – VonC Feb 20 '23 at 07:34