Search code examples
gitgit-clone

git clone from another directory


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.


Solution

  • 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.