
1- Check for an existing SSH keyls ~/.ssh/id_rsa.pub
id_rsa.pub
→ Public Key (can be shared, used to authenticate with GitLab)
id_rsa
→ Private Key (must be kept secret, never share it)
If you don’t have a public key; then generate a new onessh-keygen -t rsa -b 4096 -C "your@email.com"
Default file location for keys is ~/.ssh/id_rsa (pwd output)
2- Copy the SSH key
See your new/existed key by : cat ~/.ssh/id_rsa.pub
- Copy the key.
- Go to GitLab > Settings > SSH Keys (or visit:
https://gitlab.com/-/profile/keys
) - Click “Add new key”
- Paste the key into the Key field
- Set a title (e.g., “My Laptop SSH Key”)
- Click “Add key”
Test the connection from your local terminal by:
ssh -T git@gitlab.com
Expected output:Welcome to GitLab, @yourusername!
Once you see this, you’re successfully connected!
For the next step, click on –> this <–
For GitLab documentation : https://docs.gitlab.com/