Search code examples
gitlabssh-keysopenssh

Configuring OpenSSH according to GitLab's documentation


I've stumbled upon GitLab's documentation for setting up OpenSSH keys:

The documentation says to create a file ~/.ssh/config and gives the following example:

# GitLab.com server
Host gitlab.com
RSAAuthentication yes
IdentityFile ~/.ssh/config/private-key-filename-01

# Private GitLab server
Host gitlab.company.com
RSAAuthentication yes
IdentityFile ~/.ssh/config/private-key-filename

However, I think that the example paths for IdentityFile should be ~/.ssh/private-key-filename and not ~/.ssh/config/private-key-filename, since ~/.ssh/config is a file and not a folder.
Or am I missing something?


Solution

  • The config file path is not related to IdentityFile path and you're free to use what you want. But there is surely a typo since it's not really common to place keys in the ~/.ssh/config/ directory. Most people have their keys in ~/.ssh/. You're right, this example is wrong. You can't have the configuration file config along with a config directory containing your keys.