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 :)

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

1 Answers1

-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.

Philip Oakley
  • 13,333
  • 9
  • 48
  • 71
  • 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 – mittal Jun 17 '21 at 07:54