GitLab Configuration

1- Check for an existing SSH key

ls ~/.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 one

ssh-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

  1. Copy the key.
  2. Go to GitLab > Settings > SSH Keys (or visit: https://gitlab.com/-/profile/keys)
  3. Click “Add new key”
  4. Paste the key into the Key field
  5. Set a title (e.g., “My Laptop SSH Key”)
  6. 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/

Scroll to Top