any user can commit and push their changes in repo who access to do so through ssh key of their system, and can set their user.name , user.email by using git config --global.
I want to restrict user from their user.email mention through git config --global
For Example: I want only those user can access and commit changes to the repo who has "@gmail.com" account and no other user can commit or can push any changes even through they have access through ssh key.
We can get the user.name and user.email from the logs.
I also wrote a python script for the same to use it in pre-webhook :
author = push_data['push']['changes'][0]['commits'][0]['author']['raw'] // parth
print(author)
if(author.find('@gmail.com') < 0):
print("commit failed")
else:
print("successfully commit")
# Output: 'Harshit Goswami <harshitgoswami721@gmail.com>'(author)
'successfully commit'
but this data is retrieve from log present in my local
how can i access and get user.name and user.email of the person who want to commit?