I've just done a sparse checkout following the steps below
git clone http://location/repo.git
# create .git/info/sparse-checkout file
git config --bool core.sparsecheckout true
git read-tree -mu HEAD
Unfortunately the final step fails with the error message
Entry 'path/to/file' not update. Cannot update sparse checkout
Which is strange because (1) path/to/file
exists (2) the sparse checkout process succeeded on another machine git version 1.7.1 (Centos 6). The current machine is a Centos 7 box with git version 1.8.3.1 installed. The output of git config --list
is identical on both machines.
I fixed the problem essentially by removing all the files and repeating the same steps. It has been suggested that this could be a bug in git, or IMO some sort of file corruption.
Another solution that worked for me (YMMV). Try repeatedly checking out and the problematic directory and running git read-tree