GitLab SSH Key Windows


  1. Download git-scm
  2. GitLab server
  3. Open the C:/user/your-user/.ssh/ and create the SSH key via git-bash:
    >> ssh-keygen.exe -t rsa -b 4096
  4. Add the public key to your GitLab account
    4.1 Enter your GitLab website
    4.2 Click on your profile, then ‘Setting’ and after that select ‘SSH-Keys’
    4.3 Follow the instructions of GitLab for adding a new key
  5. Create a ‘config‘ file (without extension) in C:/user/your-user/.ssh/ and add the following content:
    Host sample_1
        user git
        port 22
        identityfile ~/.ssh/generated-private-key-file_1
    # For multiple ssh-key you can add more than one host
    Host sample_2
        user git
        port 22
        identityfile ~/.ssh/generated-private-key-file_2
  6. Test it with the git-bash console:
    git clone git@sample:project.git
  7. [Optional] If the key could not be found try to add the following argument to your environment variables:
    Name:  HOME
    Value: %USERPROFILE%