SSH Keys is an access credential used in the Secure Shell (SSH) protocol to authenticate and establish an encrypted communication channel between a client and a remote server
Establish connection between Git server
The following use Shell commands on Terminal
Client side
Create SSH key, type Ed25519, using email or username as the comment and paste it to file inside folder ~/.ssh (link Users/chiffonng/.ssh/)
ssh-keygen -t ed25519 -C "label" -f ~/.ssh/id_gitlabAdd passphrase as prompted
Add the public key to the agent, using Apple keychain (add identity)
ssh-add --apple-use-keychain ~/.ssh/id_gitlabOpen file
open ~/.ssh/configthen add configurations to ~/.ssh/config
# GitHub
Host github.com
AddKeysToAgent yes
UseKeychain yes
IdentityFile ~/.ssh/id_github
# GitLab
Host gitlab.lrz.de
HostName gitlab.lrz.de
AddKeysToAgent yes
UseKeychain yes
IdentityFile ~/.ssh/id_gitlab
IdentitiesOnly yesServer side
Copy the public key to upload to the remote server like GitLab and GitHub
pbcopy < ~/.ssh/id_gitlab.pubVerify the fingerprint
Github Ed25519 should have key fingerprint SHA256:+DiY3wvvV6TuJJhbpZisF/zLDA0zPMSvHdkr4UvCOqU after typing
ssh -T git@github.comWe can obtain the key fingerprint by running first-time connection.
ssh -T git@gitlab.lrz.deUpdate the SSH host key entry in ~/.ssh/known_hosts file with the correct fingerprint. Or we can find all server public host keys by running, and copy to ~/.ssh/known_hosts
ssh-keyscan gitlab.lrz.de