• Our product teams collect and evaluate feedback from a number of different sources. To learn more about how we use customer feedback in the planning process, check out our new feature policy.

      There are multiple cases when development teams want to check the push to the remote repository and either accept or reject it. Some may check branch names, commit messages, fast-forward merges, etc. to ensure the development process follows some particular rules.

      Currently, it does not seem to be possible with Bitbucket to use this functionality that actually comes out of the box with Git. The user does not have access to the actual remote repository to manage that. However, it can be provided in a different way using the approach similar to Bitbucket Hooks' POST request. When the repository gets triggered on "pre-receive" event, it could execute HTTP POST request supplying all the information from the push, and accept it if the POST request returns 200 or reject if any other HTTP code. This would still not require to provide direct access to the remote repository, but the users could still handle commits and reject them using their specific rules.

      PS Related but less generalized ticket:

      Enhancement BCLOUD-5658 Allow custom pre-receive hook that rejects commits without an issue key in their message

            [BCLOUD-10471] Git server-side "pre-receive" hook (BB-11418)

            Dave Parrish [Atlassian] made changes -
            Link New: This issue relates to BCLOUD-23426 [ BCLOUD-23426 ]

            pshryock added a comment -

            I guess running scripts in a sandboxed environment using Docker is just too hard. Oh wait, that's what Bitbucket pipelines do! The only difference is before receiving instead of after receiving. 🙂🔫

            pshryock added a comment - I guess running scripts in a sandboxed environment using Docker is just too hard. Oh wait, that's what Bitbucket pipelines do! The only difference is before receiving instead of after receiving. 🙂🔫

            Suhas added a comment -

            Hi All, With pre-receive hooks, one can validate the commit author email. But now, with Bitbucket Cloud enabled with Forge capabilities, you can develop apps to place this check for a pull request merge.

            For example, if a user's official email domain is "test.com" registered with Bitbucket Cloud, but they have set a different email domain "abc.com" using git config, they will still authenticate to Bitbucket Cloud using "test.com" and push commits. However, the commit author isn't recognized in the Bitbucket Cloud UI since "user@abc.com" doesn't exist as a valid Bitbucket Cloud user. Such merges to production branches can be blocked.

            Here is a sample Forge app that performs this validation: Forge App Commit Email Author Validator. For example, it blocks any email domain other than "test.com".

            Suhas added a comment - Hi All, With pre-receive hooks, one can validate the commit author email. But now, with Bitbucket Cloud enabled with Forge capabilities, you can develop apps to place this check for a pull request merge. For example, if a user's official email domain is "test.com" registered with Bitbucket Cloud, but they have set a different email domain "abc.com" using git config, they will still authenticate to Bitbucket Cloud using "test.com" and push commits. However, the commit author isn't recognized in the Bitbucket Cloud UI since "user@abc.com" doesn't exist as a valid Bitbucket Cloud user. Such merges to production branches can be blocked. Here is a sample Forge app that performs this validation: Forge App Commit Email Author Validator . For example, it blocks any email domain other than "test.com".

            Niko Dojan added a comment -

            +1 Yes, please. That would be great. I was looking for something like GitHub's secret scanner, that would refuse the push if it finds disallowed patterns in code.

            Niko Dojan added a comment - +1 Yes, please. That would be great. I was looking for something like GitHub's secret scanner, that would refuse the push if it finds disallowed patterns in code.
            Cathy S made changes -
            Remote Link New: This issue links to "Page (Confluence)" [ 893615 ]

            +1000 amazing this isn't implemented and they expect us to use F`ing forge for something so simple.

            Asaph Efrati added a comment - +1000 amazing this isn't implemented and they expect us to use F`ing forge for something so simple.

            Saxea _Flowie_ added a comment - - edited

            @Swen Auerswald - We provide pre-defined additional checks via Flowie, including the recently released commit checks plugin, where you can validate among other things, the commit commit message against a regex. It can also be defined by branch/repo. It is not a server side 'pre-receive' hook, but as per already mentioned in this ticket this is unlikely to happen.  

            Saxea _Flowie_ added a comment - - edited @Swen Auerswald - We provide pre-defined additional checks via Flowie , including the recently released commit checks plugin , where you can validate among other things, the commit commit message against a regex. It can also be defined by branch/repo. It is not a server side 'pre-receive' hook, but as per already mentioned in this ticket this is unlikely to happen.  
            Michael S made changes -
            Remote Link New: This issue links to "Page (Confluence)" [ 871764 ]

            Gordon added a comment -

            I don't know if its currently possible, but given their messaging around Forge it seems like they're trying to make it possible for us to make these sorts of customizations. I think they're reluctant to implement it themselves because then they would have to jump through flaming design hoops to make it palatable to all of their customers.

            Gordon added a comment - I don't know if its currently possible, but given their messaging around Forge it seems like they're trying to make it possible for us to make these sorts of customizations. I think they're reluctant to implement it themselves because then they would have to jump through flaming design hoops to make it palatable to all of their customers.

            Ok. If this will possible to do with Forge at all, I apparently would need to install Docker, Node.js, Forge and so on just to do the same thing a little script with a few lines could do ... There is a good German saying for that: Shooting sparrows with cannons ... Anyways, I will try to take a look into that ...

            Swen Auerswald added a comment - Ok. If this will possible to do with Forge at all, I apparently would need to install Docker, Node.js, Forge and so on just to do the same thing a little script with a few lines could do ... There is a good German saying for that: Shooting sparrows with cannons ... Anyways, I will try to take a look into that ...

              57465700c4e1 Edmund Munday
              1856873e5d88 Maxim Novikov
              Votes:
              1170 Vote for this issue
              Watchers:
              457 Start watching this issue

                Created:
                Updated: