'Multiple git users on the same instance using bash script

Hello i am trying to create a script that will enable everyone who logs into company PC to be able to commit changes to a gitlab/github repository with his own company username. I was able to create a script who will generate ssh key and grab the username + mail, but i am not sure it is good enough for my situation. Can you please advice for an approach?

    #!/bin/bash

if [[ -f  ${XXX_HOME}/.ssh/id_$SUDO_USER  ]]
then
         echo "DEBUG:There is a SSH key generated for that account, skiping step."

else
         ssh-keygen -t ed25519 -f $XXX_HOME/.ssh/id_$SUDO_USER -C "[email protected]" -q -P ""
fi

export GIT_CONFIG_PARAMETERS="'user.email=${SUDO_USER}@XXX.com' 'user.name=${SUDO_USER}'"
export GIT_SSH_KEY_NAME=id_${SUDO_USER}


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source