1

When I fire the below command:

git clone <url>

I can just see 1 folder and in that folder just 1 file viz .gitkeep.

Why my other folders and files arent getting downloaded?

  • 3
    Most likely those other files are not committed. – William Pursell Jun 29 '20 at 16:10
  • 4
    In order to answer this, we will need some more information. What files are missing? Is there a gitignore? Are there any errors or warnings when you run `git clone`? Are any of the missing folders empty? – LLSv2.0 Jun 29 '20 at 16:10
  • Is it by any chance a public repo so we can take a look? And post the command output of `git clone ` – Teharez Jun 29 '20 at 16:33
  • @LLSv2.0 no, there is no gitignore. No errors are encountered when git clone is run. Does having empty folder prevent downloading of other folders? – Sushant Gokhale Jun 29 '20 at 18:03
  • @Teharez its not a public repo. Yes will surely post the output of git clone – Sushant Gokhale Jun 29 '20 at 18:04
  • @SushantGokhale An empty folder will not prevent the download of other folders, but I do believe that an empty folder will be ignored itself. – LLSv2.0 Jun 29 '20 at 20:27
  • @LLSv2.0 Yes git ignores empty folders. That's the reason the file .gitkeep is there. It is not intepreted in any special way by git like .gitignore, but solely there so the folder will be created when cloning/pulling. See [here](https://stackoverflow.com/a/7229996/6900162). – Teharez Jun 30 '20 at 08:06
  • What branch your other folders on? – Hieu Dang Jun 30 '20 at 15:01

1 Answers1

5

Since, you have mentioned that there isn't .gitignore file, There is a chance that the files that aren't getting downloaded are committed in another branch. Make sure you git checkout to that branch and search for what you want.

Appaji Chintimi
  • 613
  • 2
  • 7
  • 19
  • This answer solves my problem. I was trying to clone on the main branch but I need to clone on a different branch. I did the following steps. 1. git branch (to check the current branch) 2. git checkout (to switch to new branch) 3. git clone Now I was able to clone the code on my local. – manish bansal Aug 17 '21 at 17:51
  • Thank you! In Visual 2022 after cloning simply switched to the correct branch (dropdown on the bottom right) – Richard Wrench May 13 '22 at 13:55