I understand the environment variable, GL_ID, is made available for the custom hooks to identify the user who performes a ‘git push’. GL_ID has the key-id value that corresponds to the record of the user’s SSH public key in the authorised_keys file.
Many GitLab admins have the need to identify the user who is pushing to a Git repository for security purposes. I’d like to know if the below woudl be the procedure to identify the user?
- Fetch the public key that corresponds to the key-id valud in the environment variable, GL_ID from the authorised_keys file
- Get list of all SSH public keys stored in GitLab’s user profiles through API
- Match the public key from authorised_keys file to the list of SSH public keys from GitLab to identify GitLab user record
Or is there a better way of identifing a user who is doing the ‘git push’ ?
Apologies if this question has already been asked. Appreciate if anyone could help or redirect to the earlier discussion.