SSH Config
Generate an SSH key:
bash
ssh-keygen -t ed25519 -C "email@example.com" -f ~/.ssh/gitlab
Add the key to the SSH agent:
bash
eval "$(ssh-agent -s)"
ssh-add ~/.ssh/gitlab
Edit the SSH config file:
bash
nano ~/.ssh/config
Paste the following:
config
Host gitlab.com
HostName gitlab.com
User git
IdentityFile ~/.ssh/gitlab
IdentitiesOnly yes
Set correct permissions:
bash
chmod 600 ~/.ssh/config
Copy the public key and paste it into GitLab Settings:
bash
cat ~/.ssh/gitlab.pub
Test the connection:
bash
ssh -T git@gitlab.com