Are you in the loop? Keep up with the latest by making sure you're subscribed to Community Announcements. Just click Watch and select Articles.

×
Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Celebration

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

Need to restrict the user's to push any change, from their e-mail I'ds

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?      

1 answer

0 votes
Theodora Boudale
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
Feb 10, 2023

Hi @Harshit_Goswami003 and welcome to the community.

I'm afraid that Bitbucket Cloud does not support server-side hooks at the moment.

We have a feature request that you can vote for to express your interest: https://jira.atlassian.com/browse/BCLOUD-10471

Until this feature is implemented, you could use client-side hooks instead. Client-side hooks need to be added to the .git/hooks directory of a repo in a user's local clone:

https://git-scm.com/book/en/v2/Customizing-Git-Git-Hooks

Kind regards,
Theodora

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PERMISSIONS LEVEL
Site Admin
TAGS
AUG Leaders

Atlassian Community Events