Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

git clone from another directory

Tags:

git

git-clone

I am trying to clone repo from another directory.

Lets say I have one repo in C:/folder1 and C:/folder2

I want to clone the work in folder1 into folder2.

What would I type into the command prompt to do this?

It seems that often when cloning a URL is provided rather then a file path, however, at this moment I am just practicing and trying to get use to Git.

like image 344
SeekingAlpha Avatar asked Jan 10 '14 13:01

SeekingAlpha


People also ask

Can you git clone inside another repository?

About cloning a repository You can push your changes to the remote repository on GitHub.com, or pull other people's changes from GitHub.com. For more information, see "Using Git". You can clone your existing repository or clone another person's existing repository to contribute to a project.

Can you git clone into an existing directory?

This can be done by cloning to a new directory, then moving the . git directory into your existing directory. If your existing directory is named "code". This can also be done without doing a checkout during the clone command; more information can be found here.


2 Answers

cd /d c:\ git clone C:\folder1 folder2 

From the documentation for git clone:

For local repositories, also supported by git natively, the following syntaxes may be used:

/path/to/repo.git/  file:///path/to/repo.git/ 

These two syntaxes are mostly equivalent, except the former implies --local option.

like image 126
Chris Avatar answered Oct 09 '22 16:10

Chris


It is worth mentioning that the command works similarly on Linux:

git clone path/to/source/folder path/to/destination/folder 
like image 32
Yasir Jan Avatar answered Oct 09 '22 16:10

Yasir Jan