Git Sparse Checkout Leaves No Entry on Working Direcotory

I am trying to use sparse-checkout to just check-out a directory from a BitBucket repository, but getting a “Sparse checkout leaves no entry on working directory” error when I try to pull.

The BitBucket repository has the following directory structure:

  • BitBucket+Jenkins: Trigger build only when specific branch is changed
  • How to resolve git error: “Updates were rejected because the tip of your current branch is behind”
  • Can't login to Bitbucket on 'Github for Windows'
  • Delete branch with cyrillic title
  • Working with multiple repositories from different servers
  • Deploying to Heroku using git on bitbucket
    • SomeProjectRepo
      • JohnsProject
      • MarysProject
      • MyProject

    I have a local directory on E:\Temp\SomeProjectRepo on my Windows 7 laptop. I want to just checkout/pull “MyProject” from the BitBucket repository to my local directory, so I can just work on E:\Temp\SomeProjectRepo\MyProject.

    So I created “E:\Temp\SomeProjectRepo” and did the following in DOS:

    1. cd E:\Temp\SomeProjectRepo
    2. git remote add origin https://bitbucket.org/blah/blah
    3. git init
    4. git config core.sparsecheckout true
    5. echo MyProject > .git/info/sparse-checkout
    6. git pull origin master

    At step 6, I get the “Sparse checkout leaves no entry on working directory”. I have tried different syntax in step 5 (e.g. MyProject\, SomeProjectRepo\*, SomeProjectRepo\MyProject\, etc, etc) but none worked.

    How do I use sparse-checkout (or any other tools) to only work on “MyProject“?

  • Local branches show-up on GitHub's “Network” view
  • how to config git repo so that all files are stored with line-ending LF ( not CFLF ) ?
  • SourceTree external merge stopped working
  • Git push error: object file is empty/loose object is corrupt
  • Git conflicts causes Storyboard problems
  • What is the difference between diff and diff-index with these flags
  • One Solution collect form web for “Git Sparse Checkout Leaves No Entry on Working Direcotory”

    OK, I got this working. As I expected it was not working because of step 5.

    The line below works now:

    echo "MyProject/*"> .git/info/sparse-checkout
    

    The important thing is to use /, use * and leave no space at the end of the directory.

    Then you may pull again or checkout the branch (git checkout master).

    Git Baby is a git and github fan, let's start git clone.