June 27, 2020

Import SSH Keys from Gitlab with ssh-import-id

Import SSH Keys from Gitlab with ssh-import-id

You may already be familiar with the tool 'ssh-import-id' and perhaps even use it to pull your keys from Github. But did you know you can use it pull keys from Gitlab as well by simply specifying a URL environment variable?!

For example, if I want to pull my keys from this made up Gitlab server I could just issue:

URL="https://gitlab.exampledomain.com/%s.keys" ssh-import-id user

All you need to do is replace your domain and 'user' for your username.
Done!