8

According to its doc, double-click should be enough. But when I opened git bash and ran git lfs init, it doesn't work:

$ git lfs init
git: 'lfs' is not a git command. See 'git --help'.
Mark Rotteveel
  • 100,966
  • 191
  • 140
  • 197
laike9m
  • 18,344
  • 20
  • 107
  • 140

2 Answers2

8

The only reason why "git lfs" would not be a git command would be because the git-lfs.exe hasn't been put in your %PATH%.

That is what the git-lfs-windows-amd64-0.5.3\install.bat is supposed to do.

set GIT_LFS_BIN_PATH="%LOCALAPPDATA%\GitLFS\bin"
IF EXIST %GIT_LFS_BIN_PATH% GOTO DIRECTORY_EXISTS
mkdir %GIT_LFS_BIN_PATH%
set "path=%PATH%;%GIT_LFS_BIN_PATH:"=%"

So:

  • Make sure install.bat was successfully executed
  • Check the content of "%LOCALAPPDATA%\GitLFS\bin"
  • make sure to open a new CMD Windows
  • Check your %PATH% environment variable
orion elenzil
  • 4,484
  • 3
  • 37
  • 49
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • 4
    This should either be in the git-lfs docs or added to the installer, as all Windows users encounter this. – Nitay Mar 27 '17 at 15:30
3

Just adding my 2c in case someone lands on this page..

The easiest (and I believe most "correct") option to install LFS on Windows is to use the windows' built-in winget package manager

winget install -e --id GitHub.GitLFS

I was getting the same error as you after simply running the downloaded installer, however the winget command fixed it for me.

PS. Even if you don't have winget - running winget will automatically install it from MS Store

Alex from Jitbit
  • 53,710
  • 19
  • 160
  • 149