failed to initialize sparse-checkout

1.8k views Asked by At

I'm getting the below error when i try to clone a folder "banana" from git repository using sparse filter;

git clone --depth 1 --filter=blob:none --sparse https://github.com/gitexpert/testGithub.git 
cd testGithub
git sparse-checkout set banana

GIT Version : 2.25.1

Error log:

Cloning into 'testGithub'...
fatal: cannot change to '://github.com/gitexpert/testGithub.git': No such file or directory
error: failed to initialize sparse-checkout
1

There are 1 answers

0
outofthecave On

The solution proposed by @satbekmyrza worked for me. I upgraded git from 2.25.1 to 2.37.3 and now sparse cloning works.

Unfortunately, the git version that is installed through the standard package repos on Ubuntu is 2.25.1 at the time of writing. In order to upgrade to a version higher than 2.25.1, one must install git from the PPA, as described at Download for Linux and Unix (git-scm.com).