Uploaded image for project: 'Bitbucket Data Center'
  1. Bitbucket Data Center
  2. BSERV-9388

Pre-receive hooks and branch permissions reject valid pushes on git 2.11


    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: High High
    • 4.13.0
    • 4.11.2, 4.12.0
    • None

      Note: This bug is fixed in Bitbucket Server 4.13 but third-party plugins (particularly plugins that check new commits as they are pushed) may also be impacted by the changes in git 2.11.


      When the "Reject Force Push" hook is enabled and the Git version is 2.11.0, all pushes to the repository fail even when the --force option is not used.

      Steps to reproduce

      1. Spin up Bitbucket Server using git v2.11.0
      2. Create a new repository and push an initial commit to it
      3. Turn the "Reject Force Push" pre-receive hook on OR setup branch permissions to prevent writing history on your branch
      4. Create a new commit and attempt to push it to Bitbucket Server

      Expected Results

      Push is successful.

      Actual Results

      Push is blocked by a pre-receive hook (or branch permissions).


      From the git 2.11 release notes:

      In order for the receiving end of "git push" to inspect the
      received history and decide to reject the push, the objects sent
      from the sending end need to be made available to the hook and
      the mechanism for the connectivity check, and this was done
      traditionally by storing the objects in the receiving repository
      and letting "git gc" expire them. Instead, store the newly
      received objects in a temporary area, and make them available by
      reusing the alternate object store mechanism to them only while we
      decide if we accept the check, and once we decide, either migrate
      them to the repository or purge them immediately.


      Downgrade to Git 2.10.x or older. Any version after Git 2.11.0 (including future 2.12+ releases) cannot be used with Bitbucket Server.

      Bitbucket Server 4.12 will fail on startup if Git 2.11+ is detected. However, older versions of Bitbucket Server (and Stash) are not aware of the 2.11 issues (since it was released after they were), but will still be broken by them. Administrators are strongly encouraged to only upgrade to Git versions which are explicitly marked supported on our Supported Platforms for the version of the product they're running.

            bturner Bryan Turner (Inactive)
            fhaehnel Felix
            20 Vote for this issue
            42 Start watching this issue