macosgitsparse-checkout

error: Sparse checkout leaves no entry on working directory


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:

  1. mkdir repoDir
  2. git init repoDir
  3. cd repoDir
  4. git remote add origin <repo url>
  5. git config core.sparsecheckout true
  6. echo "some/dir/" >> .git/info/sparse-checkout
  7. 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:

My git version: git version 1.9.3 (Apple Git-50)

OSX Yosemite 10.10.2 (14C109)


Solution

  • It turns out that "some/dir/" was wrong, since I didn't have the repository I didn't know it's real structure. I was able to browse it through web interface but I just discovered the folders don't correspond exactly to the real repository folder structure.

    Lesson for the future: make sure you know the folder structure before creating sparse-checkout file.