Pull Request Merge fails with: git-lfs smudge --skip: git-lfs: not found

XMLWordPrintable

    • Type: Bug
    • Resolution: Obsolete
    • Priority: High
    • None
    • Affects Version/s: 5.9.0
    • Component/s: Git LFS
    • None
    • 7
    • Severity 3 - Minor
    • 15

      Symptom

      Merging pull requests fail, with the log file contain an error:

      2018-04-09 08:18:08,036 INFO  [http-nio-7990-exec-3] admin @80IBIIx498x89x0 1090a1m 0:0:0:0:0:0:0:1 "GET /rest/api/latest/projects/PROJECT_1/repos/lfstest/pull-requests/3/merge HTTP/1.1" c.a.s.i.s.g.p.DefaultPullRequestAutoMergeStrategy PROJECT_1/lfstest[2]: Pull request 3@0 failed automatic merging: '/tmp/git-install/bin/git merge -m Automatic merge --no-ff --no-log 603cf2f69e50cb46f80f948c6eb579450518ac93' exited with code 0 saying: git-lfs smudge --skip: 1: git-lfs smudge --skip: git-lfs: not found
      error: external filter git-lfs smudge --skip failed -1
      error: external filter git-lfs smudge --skip failed
      git-lfs smudge --skip: 1: git-lfs smudge --skip: git-lfs: not found
      error: external filter git-lfs smudge --skip failed -1
      error: external filter git-lfs smudge --skip failed
      

      Background

      The Bitbucket Server instance does not need the Git LFS client installed, and specifically, the user running the Bitbucket Server process SHOULD NOT have the Git LFS client installed. Installing the LFS client means the following gets added to the user's ~/.gitconfig file:

      [filter "lfs"]
      	clean = git-lfs clean -- %f
      	smudge = git-lfs smudge -- %f
      	process = git-lfs filter-process
      	required = true
      

      As a result the clean & smudge filters are run when Bitbucket Server invokes the Git executable for some operations such as merging pull requests. The problems caused by this are documented here: https://jira.atlassian.com/browse/BSERV-9616

      To fix the problem described in BSERV-9616, as of Bitbucket Server 5.9.0 the .git/config file that Bitbucket Server writes into its temporary worktree includes the following:

      [filter "lfs"]
      	required = false
      	process =
      	smudge = git-lfs smudge --skip
      

      The intention being, any LFS filter configured in the global Git configuration file is overridden.

      The Regression

       The above mentioned fix for BSERV-9616 breaks systems in the following state:

      • Bitbucket Server 5.9.0 - 5.16
      • Git version earlier than 2.11.0 installed
      • Git LFS client is NOT installed for the user running the Bitbucket Server instance

      The problem occurs because Git is trying to run the git-lfs command, it however cannot be found.

      Workaround

      Update Git on the Bitbucket Server instance to 2.11.0 or later

              Assignee:
              Unassigned
              Reporter:
              Ben Humphreys
              Votes:
              6 Vote for this issue
              Watchers:
              13 Start watching this issue

                Created:
                Updated:
                Resolved: