Search code examples
gitcmdgit-lfs

Only "which git lfs" doesn't work in windows prompt


I just started to use git and git-lfs several days ago, and this problem came out. I could use any git command both in Git bash and windows cmd but "which git lfs". It works fine in Git bash but not in cmd, it said 'which' is not recognized as an internal or external command, operable program or batch file. I checked my Path variable and GIT LFS was included, so this made me really confused. Is "which git lfs" a special command only for Git bash? Thanks for your help!


Solution

  • which is a bash command. The equivalent command in CMD.exe is where. I believe PowerShell uses which.

    In any case, these are shell commands to locate what program would be used to execute another command; they are not git commands.

    I doubt which git lfs is what you mean. That would search for two programs: one to be executed by the git command and one to be executed by the lfs command. But lfs isn't its own command - its one possible argument to git. You could mean which git-lfs which should find the program to which git delegates when the subcommand lfs is given.