Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Bitbucket Pipelines: Pipeline failures due to a 'pre-push hook already exists' error

We are rolling out an upgrade for the Git client used to clone a repository during the pipeline setup stage. As a part of this upgrade, Git LFS will upgrade from v2.13.2 to v3.1.4. Unfortunately, this upgrade introduces some breaking changes which have impacted a small number of Bitbucket Pipelines users. Some pipelines that use LFS may fail with a Hook already exists: pre-push error, such as:

Hook already exists: pre-push
command -v git-lfs >/dev/null 2>&1 || { echo >&2 "\nThis repository is configured for Git LFS but 'git-lfs' was not found on your path. If you no longer wish to use Git LFS, remove this hook by deleting '.git/hooks/pre-push'.\n"; exit 2; }
git lfs pre-push "$@"
To resolve this, either:
1: run `git lfs update --manual` for instructions on how to merge hooks.
2: run `git lfs update --force` to overwrite your hook.



The newer version of Git LFS has introduced some minor changes to the Git hooks it installs. During the repository clone stage, hooks are installed using Git LFS version specified above. If your pipeline also tries to install hooks using git lfs install or git lfs update, you may see this error, depending on Git LFS version you have installed in your build container.


To resolve the issue, you can either:

  • Remove git lfs install command, as hooks are already installed during clone process.

  • Upgrade Git LFS version you have installed in your build container to v3.1.1 or higher.

  • Add a force flag: git lfs install --force to overwrite your hook.



Log in or Sign up to comment
AUG Leaders

Atlassian Community Events