0

So after trying multiple tutorials, questions/answers I am still not able to get git sparse-checkout working on Windows 10 with git 2.25

Background

Our repo moved from perforce to git recently and now I am trying to get git working on Windows with my repo, but am failing miserably.

The repo itself is huge 20GB and there are files in there with names aux.c,aux.h,nul which are invalid in Windows. With Perforce it was simple to map only the required directory on Windows and work with it. I certainly don't need those files on Windows

What I have been trying

git clone --no-checkout --depth=1 <repo-url> test-dir cd test-dir git sparse-checkout init --cone 

But the sparse-checkout tries to get a file named nul from a directory which fails

So I replaced sparse-checkout init with

git config core.sparsecheckout true echo 'automation/python/my-automation' >> .\git\info\sparse-checkout git read-tree -mu HEAD 

It again runs into that invalid path error due to nul file 'automation/ruby/.../nul'

I thought maybe I am running into issue described here so I downgraded git version from 2.27 to 2.25, without luck :(

How do I skip these unnecessary files from checkout and work with only one directory ? I can't ask the other teams to delete their files :)

5
  • Sorry, I meant .git\info\sparse-checkout, fixed now Commented Jun 11, 2021 at 7:40
  • Any help/inputs for this one ?? Commented Jun 15, 2021 at 15:23
  • backslashes aren't path separators in the unix envirornment. Use forward slashes. Backslashes are syntax escapes. Commented Jun 16, 2021 at 18:01
  • @jthill I have tried both, could not get it working. The solution provided here, github.com/uvdl/linux-fslc/issues/1 doesn't work for me Commented Jun 17, 2021 at 7:50
  • This one seems to be similar. core.protectNTFS false stackoverflow.com/questions/63727594/… Commented Jun 18, 2021 at 11:26

1 Answer 1

-1

The file nul is a prohibited filename on Windows. There is a set of similar filenames that are prohibited.

see https://brendanforster.com/notes/fixing-invalid-git-paths-on-windows/ for possible work arounds.

Sign up to request clarification or add additional context in comments.

1 Comment

This links is asking to modify the files. But as I said in my post, those files are not owned by me so I can't touch them at all

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.