DEV Community

Pheak Pheasa
Pheak Pheasa

Posted on

how to get SSH Keys for gitlab for mac?

  1. 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"
Enter fullscreen mode Exit fullscreen mode
  • Press Enter to save it in the default location.
  • Set a passphrase or leave it empty for no passphrase.
  1. Start SSH Agent Start the SSH agent to manage your keys:
   eval "$(ssh-agent -s)"
Enter fullscreen mode Exit fullscreen mode
  1. Add SSH Key Add your new key to the SSH agent:
   ssh-add -K ~/.ssh/id_rsa
Enter fullscreen mode Exit fullscreen mode
  1. Copy SSH Key Copy your SSH public key to paste into GitLab:
   pbcopy < ~/.ssh/id_rsa.pub
Enter fullscreen mode Exit fullscreen mode
  1. 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)