I tried to install git-lfs using

sudo apt install git-lfs but experienced the following error:

Reading package lists... Done Building dependency tree
Reading state information... Done
git-lfs is already the newest version (2.9.2). 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. 1 not fully installed or removed. After this operation, 0 B of additional disk space will be used. Do you want to continue? [Y/n] y Setting up git-lfs (2.9.2) ... /usr/local/bin/git-lfs:
1: /usr/local/bin/git-lfs: ????: not found /usr/local/bin/git-lfs: 5: /usr/local/bin/git-lfs: Syntax error: end of file unexpected (expecting ")")
dpkg: error processing package
git-lfs (--configure): installed git-lfs package post-installation
script subprocess returned error exit status 2 Errors were encountered while processing: git-lfs
E: Sub-process /usr/bin/dpkg returned an error code (1)

The related solution in install git-lfs on Ubuntu 16.04 did not work for me either and flagged the same error. Does anyone have a workaround/solution?

  • Please do some proper formatting. Jan 13, 2020 at 20:56

1 Answer 1


You have git-lfs installed in /usr/local/bin/git-lfs.

This path is not maintained by APT. I would suggest to remove this file with

sudo rm /usr/local/bin/git-lfs

and retry with package reinstallation:

sudo apt-get install --reinstall git-lfs

and it will install git-lfs executable into correct location - /usr/bin/git-lfs (see file list).

  • Thank you. After removing the file, I was able to do sudo apt install git-lfs.
    – FSeed
    Jan 14, 2020 at 16:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.