After installing the latest version of the Git client (git version 2.34.1.windows.1), the following error is reported when pulling code from gitlab:
1
2
3
4
5
6
7
8
9
10
11
|
$ git pull -r -v
The authenticity of host ‘[gitlab.lzw.me]:10022 ([xxx.xxx.xxx.xxx]:10022)’ can’t be established.
ED25519 key fingerprint is SHA256:K+/XdcpPLPqHJsmSIsXHUMIrRVxivN9//YiYFp7VQeM.
This key is not known by any other names
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
Warning: Permanently added ‘[gitlab.lzw.me]:10022’ (ED25519) to the list of known hosts.
git@gitlab.lzw.me: Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
|
According to the analysis of the error message, you need to use the key of ED25519 SSH
, which is the key of RSA SSH
generated a long time ago.
The solution is as follows.
Open terminal
terminal under Mac/Linux, or Git Bash
under windows, and execute the command to generate ED25519 SSH
key.
1
|
ssh-keygen -t ed25519 -C "email@lzw.me"
|
Copy the contents of the generated ED25519 SSH
public key file ~/.ssh/id_ed25519.pub
and add it in the gitlab SSH Keys panel.
Command line copy of ~/.ssh/id_ed25519.pub
contents ref.
1
2
3
4
5
6
7
8
|
# macOS
pbcopy < ~/.ssh/id_ed25519.pub
# WSL / GNU/Linux (requires the xclip package):
xclip -sel clip < ~/.ssh/id_ed25519.pub
# Git Bash on Windows:
cat ~/.ssh/id_ed25519.pub | clip
|
Related references.