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