0

I tried to clone only a subdirectory of a Git repository using this answer but it doesn't work.

I use Ubuntu for Windows (WSL) and I used these commands:

$ git init
$ git remote add -f origin <repo-ssh>
$ git config core.sparseCheckout true
$ echo 'FolderName/' >> .git/info/sparse-checkout
$ git pull origin master
fatal: couldn't find remote ref master

$ git pull origin main
 * branch            main       -> FETCH_HEAD
Already up to date.

'FolderName/' in this case: 'Exercise2/'

I don't know how to fix.

And the remote branch name is main.

Pylyp Dukhov
  • 38,521
  • 10
  • 57
  • 92
Setembru
  • 1
  • 2
  • 3
    What does "`'FolderName/'` in this case: `'Exercise2/'`" mean? What do you need to "fix"? Please read [ask]. – Chris Sep 26 '21 at 22:07

1 Answers1

-1

Your question is a bit ambiguous. But I think this should solve your problem:

git remote set-url origin https://github.com/your/repository

Follow the rest steps as usual. Just change your remote origin url.

senarijit1618
  • 339
  • 3
  • 13