How do I add an SSH key in gitlab?

Go to your GitLab account: https://gitlab.com/

Click on Settings on the top right drop-down, which will appear once you select the icon(white-fox image [specific to my profile]). enter image description here

Click on Settings on the top right drop-down, which will appear once you select the icon(white-fox image).

Click on SSH Keys:
enter image description here

Add/Paste the SSH Key.
How to generate the ssh key: Download gitbash or putty:

After downloading gitbash/putty follow the steps:

  1. Open a terminal on Linux or macOS, or Git Bash / WSL on Windows.
  2. Generate a new ED25519 SSH key pair:

    ssh-keygen -t ed25519 -C "[email protected]"  
    

    Or, if you want to use RSA:

    ssh-keygen -t rsa -b 4096 -C "[email protected]"  
    

    It will generate the key in => C:\Users\yourname.ssh directory.

  3. Copy the public key and paste in the gitlab location:

    enter image description here

Command to run on gitbash to clone the repository:

ssh-agent $(ssh-add C:\Users\youname\.ssh\id_rsa; git clone [email protected]:xyz/SpringBootStarter.git)

Just follow the official guides to Create and Add SSH keys.


  1. You need to sign in. Green button top right.
  2. Click 'profile settings' on the left side menu.
  3. Click SSH Keys and follow the instructions on the page.