Can gitlab-shell make GitLab's username available to hook's shell environment ?
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.
Below will one of the approaches to identify the user who is interacting with the Git Repository.
- 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' ?
Can gitlab-shell make GitLab's username available to hook's shell environment ? It'll be far easier for custom hooks to fetch the user name instead of the round-about way described above. As, GL_ID has the key-id that corresponds to the ssh key in authorised_keys file, I might suggest a new environment variable for this purpose.