8

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
asked May 13, 2022 at 2:07
5
  • 1
    Remove the $ in front of https and try again? Commented May 13, 2022 at 2:10
  • that was just typo, i fixed it . I'm still getting the same error though Commented May 13, 2022 at 2:13
  • 2
    You asked this after you asked why, though the clone succeeded and the set succeeded, a subsequent checkout extracted extra files. So did it mysteriously stop working? Commented May 13, 2022 at 4:25
  • 2
    I also had the same issue with git 2.25.1. After updating git to 2.37.1 (latest at the time), the problem is gone. Commented Aug 2, 2022 at 8:30
  • 1
    although i haven't verified myself, the issue seems to be addressed in this commit 47dbf10d. therefore using git v2.26 or higher should fix this issue Commented Oct 4, 2022 at 19:46

1 Answer 1

7

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).

answered Sep 26, 2022 at 15:32
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.