Problem #
Single command to import SSH keys from GitLab.
Solution #
As root, use the command below:
1runuser -l local_user -c 'URL="https://gitlab.com/%s.keys" ssh-import-id gitlab_user'
Explanation #
The local_user is the username for accessing the system via SSH.
The gitlab_user is GitLab's username that has the SSH keys stored.
The URL variable is used to specify the URL pattern for fetching the SSH keys. Replace it for fetching SSH keys from a different source.
last updated: