Sadly none of the above worked for me so I spent very long time trying different combination of sparse-checkout
file.
In my case I wanted to skip folders with IntelliJ IDEA configs.
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 following content
!.idea/*
!.idea_modules/*
/*
Run ‘git checkout –‘ to get all files.
Critical thing to make it work was to add /*
after folder’s name.
I have git 1.9