2

I have a local git repo, with LFS enabled.

I often need to clone it somewhere else on the same drive. While copy-pasting the repo would do exactly what I want, I face some issue doing this with git itself :

cd C:\wrkfldr\SUBDIR
git clone "C:\wrkfldr\LOCAL_REPO\.git"

Returns

Cloning into 'LOCAL_REPO'...
done.
Downloading BIG_LFS_FILE.xlsm (6.4 MB)
Error downloading object: BIG_LFS_FILE.xlsm (01d6d9b): Smudge error: Error downloading BIG_LFS_FILE.xlsm (01d6d9b68a17724fbd7e5aad72b643621edf1ac9ccd34f3ea0874a870af87e4c): batch request: ssh: Could not resolve hostname c: Name or service not known: exit status 255

Errors logged to C:\Users\LOCAL_REPO\.git\lfs\logs\20191203T095345.1265547.log
Use `git lfs logs last` to view the log.
error: external filter 'git-lfs filter-process' failed
fatal: BIG_LFS_FILE.xlsm: smudge filter lfs failed
warning: Clone succeeded, but checkout failed.
You can inspect what was checked out with 'git status'
and retry with 'git restore --source=HEAD :/'

It looks like LFS wants to download the file, viewing the drive letter C as a protocol, while everything is local.

I'm under Windows 10.

Has anyone ever encountered this ?

Arthur Attout
  • 2,701
  • 2
  • 26
  • 49

1 Answers1

5

For Windows/Linux you have to use file:/// prefix:

git clone file:///C:/wrkfldr/LOCAL_REPO/.git

Check out this interesting answer for details: GIT clone repo across local file system in windows

funnydman
  • 9,083
  • 4
  • 40
  • 55
  • This cloned the repo successfully indeed (although I had to replace all backslashes with slashes). But all LFS are not pulled. When I do this, only the last LFS file in the working dir is downloaded, but all previous version do not exist (the `.git` directory doesn't contain them) – Arthur Attout Dec 03 '19 at 09:21
  • My bad, I think this is explained in the link you gave [LFS pointer files](https://github.com/git-lfs/git-lfs/wiki/Tutorial#lfs-pointer-files-advanced) – Arthur Attout Dec 03 '19 at 09:23
  • @ArthurAttout feel free to ask any questions. – funnydman Dec 03 '19 at 09:28
  • 3
    I don't think this is even Windows-specific; adding `file://` to the remote URL helped me under Linux as well. – Thomas Apr 30 '20 at 13:40
  • As @Thomas indicated, this is definitely not specific to windows. Despite the age, it might be worth updating the answer to reflect that this helps fix lfs problems even with latest git and git-lfs on ubuntu. – Tim Nov 18 '22 at 00:07
  • 1
    @Tim eventually updated, thanks! – funnydman Nov 18 '22 at 05:34