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

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

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: High
    • Resolution: Fixed
    • Affects Version/s: 4.11.2, 4.12.0
    • Fix Version/s: 4.13.0
    • Component/s: None
    • Labels:

      Description

      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.

      Summary

      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).

      Cause

      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.

      Workaround

      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.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              bturner Bryan Turner
              Reporter:
              fhaehnel Felix Haehnel
              Votes:
              20 Vote for this issue
              Watchers:
              45 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: