In your .ssh directory you should have the following optional files:
| File | Description | 
|---|---|
| authorized_keys | List of public keys that can be used to ssh into current machine | 
| config | Configuration file for SSH | 
| id_rsa | Your private key, must have permissions 0600 | 
| id_rsa.pub | Your public key, you add the content of this file into authorized_keyson servers/machines you want to have access to | 
To generate private and public key, run ssh-keygen command in your terminal.
Add the following code snippets into your ~/.ssh/config file:
Host mygitlab
    HostName gitlab.com
    User my-gitlab-user
    IdentityFile ~/.ssh/my-gitlab-key
    IdentitiesOnly yes
    StrictHostKeyChecking no
    PreferredAuthentications publickey
Now, use an url like this to clone your repository:
git clone git@mygitlab:account/project.git
Host my-server
    HostName xxx.xxx.xxx.xxx
    User myuser
    IdentityFile ~/.ssh/myserver
    IdentitiesOnly yes
    StrictHostKeyChecking no
Run command ssh my-server
Host 10.10.*.*
    User myotheruser
    IdentityFile ~/.ssh/myotherserver
    IdentitiesOnly yes
    StrictHostKeyChecking no
StrictHostKeyChecking no
Host webserver
    Hostname www.mywebserver.com
    HostKeyAlias www.mywebserver.com
    ProxyCommand ssh jump.server.com -W %h:%p
Connect using ssh webserver