- Generate SSH Key Run this command in your terminal to generate a new SSH key:
ssh-keygen -t rsa -b 4096 -C "your_email@example.com"
- Press
Enter
to save it in the default location. - Set a passphrase or leave it empty for no passphrase.
- Start SSH Agent Start the SSH agent to manage your keys:
eval "$(ssh-agent -s)"
- Add SSH Key Add your new key to the SSH agent:
ssh-add -K ~/.ssh/id_rsa
- Copy SSH Key Copy your SSH public key to paste into GitLab:
pbcopy < ~/.ssh/id_rsa.pub
-
Add Key to GitLab
- Go to GitLab > Settings > SSH Keys.
- Paste the copied key in the key field and add a title.
Done! Now you can clone or push to repositories securely.
Top comments (0)