First, let me tell you that I have already checked all the similar threads and searched google to find what the problem may be, but no success. My problem is that I'm trying to use sparse checkout in git, but I get this error:
error: Sparse checkout leaves no entry on working directory
I have this 60GB repository, which I need to clone. I need only a part of it, so to save a disk space I wanted to use sparse checkout. This is what I do:
mkdir repoDir
git init repoDir
cd repoDir
git remote add origin <repo url>
git config core.sparsecheckout true
echo "some/dir/" >> .git/info/sparse-checkout
git pull --depth=1 origin master
Note I add the remote without -f flag, so nothing is fetched.
The result:
error: Sparse checkout leaves no entry on working directory
I tried several things:
- Instead of initialising new repo and adding the remote manually, I did
git clone --no-checkout
and then set up the sparse checkout. This didn't help as mygit status
showed as if I deleted all the files in my repo. Thegit pull origin master
command results in the same error. - Tried all possible combination of paths in step 6, with preceding slashes, slashes after the path, stars, spaces between path and
>
or>>
. Btw I'm confused what is the correct format here, from the comments on SO I see mutually exclusive ways of formatting this. - Tried to make sure my
.git/info/sparse-checkout
is ASCII, and has proper line endings as found here. This is probably only problematic on Windows, but I just checked this anyway.
My git version: git version 1.9.3 (Apple Git-50)
OSX Yosemite 10.10.2 (14C109)