Git Clone (automated folder in Directory)

I was cloning my repository to my local directory

what I don’t understand is why it created another Folder call `fCC-LandingPage into my local directory?

any help is appreciated

Because you’ve just cloned a repository called “fCC-LandingPage” to your local directory. What did you think the directory full of files you’ve just cloned would be called?

I have also been confused by this behaviour, before. It often meant I would create a folder for my repo, but my repo would be put inside another folder inside this. In fact, I still have to run:

cd freeCodeCamp/freeCodeCamp

If I want to get into the repo directory.


An explanation:

  • You are cloning a Git Repository
  • Specifically, you are not cloning a bunch of files
  • This means you will get a whole new folder which is the repository directory

The reason for this is to prevent you from cloning a repository inside another repository (I am not sure if ‘repository’ is the best word here, as I am not sure if this is a word native to Git).

So, simplest solution is to just remember to be in the parent directory of where you want the repository to be. Otherwise, I would imagine there is an option in Git to clone in specified ways (no new folder, into a specific folder, or with a specific name).

That is just my way of thinking about it, and my way to remember to stop creating folders named after the repo I am about to clone.

2 Likes

thank you @Sky020 for the feedback

I’ll focus on creating the directory only from now onwards, this saves me time as well which is a bonus

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.