git克隆从另一个目录

我试图从另一个目录克隆回购。

比方说,我有一个回购在C:/folder1C:/folder2

我想将folder1的工作克隆到folder2

我会input什么命令提示符来执行此操作?

似乎经常提供克隆一个URL而不是一个文件path,然而,在这一刻,我只是练习,并尝试使用Git。

 cd /dc:\ git clone C:\folder1 folder2 

git clone的文档 :

对于本地支持的本地存储库,可以使用以下语法:

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

这两个语法大部分是等价的,除了前者意味着–local选项。

这些都没有为我工作。 我在Windows上使用git-bash。 发现问题是我的文件path格式。

错误:

 git clone F:\DEV\MY_REPO\.git 

正确:

 git clone /F/DEV/MY_REPO/.git 

这些命令是从想要repo文件夹出现的文件夹中完成的。

它看起来很简单。

 14:27:05 ~$ mkdir gittests 14:27:11 ~$ cd gittests/ 14:27:13 ~/gittests$ mkdir localrepo 14:27:20 ~/gittests$ cd localrepo/ 14:27:21 ~/gittests/localrepo$ git init Initialized empty Git repository in /home/andwed/gittests/localrepo/.git/ 14:27:22 ~/gittests/localrepo (master #)$ cd .. 14:27:35 ~/gittests$ git clone localrepo copyoflocalrepo Cloning into 'copyoflocalrepo'... warning: You appear to have cloned an empty repository. done. 14:27:42 ~/gittests$ cd copyoflocalrepo/ 14:27:46 ~/gittests/copyoflocalrepo (master #)$ git status On branch master Initial commit nothing to commit (create/copy files and use "git add" to track) 14:27:46 ~/gittests/copyoflocalrepo (master #)$ 

如果您的path中有空间,请用双引号括起来:

 $ git clone "//serverName/New Folder/Target" f1/ 

使用git clone c:/folder1 c:/folder2

 git clone [--template=<template_directory>] [-l] [-s] [--no-hardlinks] [-q] [-n] [--bare] [--mirror] [-o <name>] [-b <name>] [-u <upload-pack>] [--reference <repository>] [--separate-git-dir <git dir>] [--depth <depth>] [--[no-]single-branch] [--recursive|--recurse-submodules] [--]<repository> [<directory>] <repository> The (possibly remote) repository to clone from. See the URLS section below for more information on specifying repositories. <directory> The name of a new directory to clone into. The "humanish" part of the source repository is used if no directory is explicitly given (repo for /path/to/repo.git and foo for host.xz:foo/.git). Cloning into an existing directory is only allowed if the directory is empty.