0

I have a remote repository called "myproject" in this remote path:

\\TCV\data\folder1\folder2\folder3\myproject\

I want to clone it on a local drive as follows:

E:\_server_\htdocs\myproject\

The problem is that when I run the CLONE command, by stating as

Source:

\\TCV\data\folder1\folder2\folder3\myproject\

and destination:

E:\_server_\htdocs\myproject\

I get the following directory structure as a result:

E:\_server_\htdocs\myproject\TCV\data\folder1\folder2\folder3\myproject\

How do I clone the project without all its parents folders?

I don't need "TCV\data\folder1\folder2\folder3\"

John Zwinck
  • 239,568
  • 38
  • 324
  • 436
majimekun
  • 210
  • 2
  • 10
  • Show us the exact command. – John Zwinck Nov 24 '17 at 12:11
  • I don't know what went wrong in your scenario without looking at your git clone command. But now that you have it cloned, you could simply copy the 'myproject' folder to where you want it. The 'myproject' folder should contain the .git folder, which has the link to the remote setup – smerlung Nov 24 '17 at 12:19
  • @JohnZwinck I'm using Visual Studio Code's GUI for that (GIT commands are implemented by default), so no real command line use in that scenario. The GUI asks me to enter the source path and then the target path. That's it. – majimekun Nov 27 '17 at 01:44
  • @smerlung Yeah that's what I did instinctively first but then I thought that maybe it is a bad practice and also, it's a little bit cumbersome when you have lots of projects to clone. – majimekun Nov 27 '17 at 01:47
  • @majimekun yes I agree. – smerlung Nov 27 '17 at 07:39
  • If your git repository contains all those folders then you can't easily clone it without them. You probably want to look at [sparse checkout](https://stackoverflow.com/questions/4114887/is-it-possible-to-do-a-sparse-checkout-without-checking-out-the-whole-repository). – Lasse V. Karlsen Nov 27 '17 at 07:56
  • Possible duplicate of [Is it possible to do a sparse checkout without checking out the whole repository first?](https://stackoverflow.com/questions/4114887/is-it-possible-to-do-a-sparse-checkout-without-checking-out-the-whole-repository) – Lasse V. Karlsen Nov 27 '17 at 07:58

1 Answers1

0

Without the exact git clone command you used, it is hard to tell what is wrong.

But this is how you should do it:

cd E:\_server_\htdocs\

if the path E:\_server_\htdocs\ doesn't exist then create it.

git clone \\TCV\data\folder1\folder2\folder3\myproject\
smerlung
  • 1,459
  • 1
  • 13
  • 32