0

When I cloning a local remote repository using Git LFS on Windows, pointer files are not created for files being tracked by Git LFS; instead, the actual files themselves are copied directly. This means that Git LFS is not working as intended.

However, when cloning the same repository using Git within WSL (Windows Subsystem for Linux), Git LFS works correctly.

Here Are the commands:

1. Create an local repo with lfs tracing:

G:\GitLfsTest>cd LocalRepo

G:\GitLfsTest\LocalRepo>git init
Initialized empty Git repository in G:/GitLfsTest/LocalRepo/.git/

G:\GitLfsTest\LocalRepo>git lfs install
Updated Git hooks.
Git LFS initialized.

G:\GitLfsTest\LocalRepo>git lfs track *.obj
Tracking "*.obj"

G:\GitLfsTest\LocalRepo>git add .

G:\GitLfsTest\LocalRepo>git commit -am "init"
[master (root-commit) 87a1ddd] init
 3 files changed, 7 insertions(+)
 create mode 100644 .gitattributes
 create mode 100644 00001.obj
 create mode 100644 00002.obj

2. Cloning This Repo in win11

G:\GitLfsTest\Windows>git clone ..\LocalRepo
Cloning into 'LocalRepo'...
done.

G:\GitLfsTest\Windows>cd LocalRepo

G:\GitLfsTest\Windows\LocalRepo>dir
驱动器 G 中的卷是 项目
卷的序列号是 7290-2C6C

G:\GitLfsTest\Windows\LocalRepo 的目录
2025/01/25  14:34    <DIR>          .
2025/01/25  14:34    <DIR>          ..
2025/01/25  14:34                43 .gitattributes
2025/01/25  14:34         1,654,361 00001.obj
2025/01/25  14:34         2,198,170 00002.obj
           3 个文件      3,852,574 字节
           2 个目录 519,251,529,728 可用字节

00001.obj and 00002.obj are with 1,654,361 byte and 2,198,170 byte.

3. Cloning This Repo in Ubuntu24 in wsl2

:~$ cd /mnt/g/GitLfsTest/Ubuntu/

:/mnt/g/GitLfsTest/Ubuntu$ git clone ../LocalRepo/
Cloning into 'LocalRepo'...
done.

:/mnt/g/GitLfsTest/Ubuntu$ cd LocalRepo/
:/mnt/g/GitLfsTest/Ubuntu/LocalRepo$ vim 00001.obj

version https://git-lfs.github.com/spec/v1
oid sha256:8bdf1603e445eb95f4899934333207628d41aed9ecbcbd6ed96608aed8dc2634
size 1654361

00001.obj and 00002.obj are pointer files with sha256 infomation.

Why are there two different results? and how can I make git lfs in win11 produce the same result as git lfs in ubuntu?

1
  • git clone --local: "When the repository to clone from is on a local machine, this flag bypasses the normal "Git aware" transport mechanism… If the repository is specified as a local path … this is the default…" The bottom line: try git clone --no-local. "Specifying --no-local will override the default when /path/to/repo is given, using the regular Git transport instead." Commented Jan 25 at 13:12

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.