Unfortunately, none of the above worked for me, so for a very long time I tried a different combination of the sparse-checkout file.
In my case, I wanted to skip the IntelliJ IDEA configuration folders.
Here is what I did:
Run git clone https://github.com/myaccount/myrepo.git --no-checkout
Run git config core.sparsecheckout true
Created .git\info\sparse-checkout with the following contents
!.idea
Run 'git checkout -' to get all the files.
The key task to make it work was to add /* after the folder name.
I have git 1.9
expert
source share