I have the following problem.
I want to clone a repo from our GitLab instance, however, I get the following error:
git@gitlab.com: Permission denied (publickey). fatal: Could not read from remote repository.
I have already spent hours searching the internet, but none of the solutions have worked for me.
More Information: Win10, WSL2
How I have proceeded so far:
ssh-keygen -t ed25519 -C "your_email@example.com"
exec ssh-agent bash
ssh-add ~/.ssh/id_ed25519
Then Add the publickey to GitLab.
Nevertheless, I won't work.
Output of
ssh -Tv git@gitlab.com
OpenSSH_8.2p1 Ubuntu-4ubuntu0.5, OpenSSL 1.1.1f 31 Mar 2020
debug1: Reading configuration data /home/<user>/.ssh/config
debug1: /home/<user>/.ssh/config line 1: Applying options for gitlab.com
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: include /etc/ssh/ssh_config.d/*.conf matched no files
debug1: /etc/ssh/ssh_config line 21: Applying options for *
debug1: Connecting to gitlab.com [<ip-adress>] port 22.
debug1: Connection established.
debug1: identity file /home/<user>/.ssh/id_rsa.pub type -1
debug1: identity file /home/<user>/.ssh/id_rsa.pub-cert type -1
debug1: Local version string SSH-2.0-OpenSSH_8.2p1 Ubuntu-4ubuntu0.5
debug1: Remote protocol version 2.0, remote software version OpenSSH_7.4
debug1: match: OpenSSH_7.4 pat OpenSSH_7.0*,OpenSSH_7.1*,OpenSSH_7.2*,OpenSSH_7.3*,OpenSSH_7.4*,OpenSSH_7.5*,OpenSSH_7.6*,OpenSSH_7.7* compat 0x04000002
debug1: Authenticating to gitlab.com:22 as 'git'
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: algorithm: curve25519-sha256
debug1: kex: host key algorithm: ecdsa-sha2-nistp256
debug1: kex: server->client cipher: chacha20-poly1305@openssh.com MAC: <implicit> compression: none
debug1: kex: client->server cipher: chacha20-poly1305@openssh.com MAC: <implicit> compression: none
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: Server host key: ecdsa-sha2-nistp256 SHA256:ATGbzTPAlJZOY5gURztKPIuzAC/eN22PApBTfUW8oQA
debug1: Host 'gitlab.com' is known and matches the ECDSA host key.
debug1: Found key in /home/<user>/.ssh/known_hosts:13
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: Will attempt key: /home/<user>/.ssh/id_rsa.pub explicit
debug1: SSH2_MSG_EXT_INFO received
debug1: kex_input_ext_info: server-sig-algs=<rsa-sha2-256,rsa-sha2-512>
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey,gssapi-keyex,gssapi-with-mic,password
debug1: Next authentication method: publickey
debug1: Trying private key: /home/<user>/.ssh/id_rsa.pub
no such identity: /home/<user>/.ssh/id_rsa.pub: No such file or directory
debug1: No more authentication methods to try.
git@gitlab.com: Permission denied (publickey,gssapi-keyex,gssapi-with-mic,password).
In the process of me trying to fix this problem I've written a config file which looks like this:
Host <myhost>
HostName <myhostname>
User <username>
PreferredAuthentications publickey
IdentityFile ~/.ssh/id_ed25519.pub
PubkeyAcceptedKeyTypes=+ssh-rsa
TCPKeepAlive Yes
Please be aware, that I have to censor some outputs.
If you have any ideas, which could help me, I would be very happy to hear them.
Edit: With the Steps provived in the Reply, I can clone now using WSL but not with Gitbash.