我想克隆從另一個目錄的回購。git克隆從另一個目錄
可以說,我有一個C:/folder1
回購和C:/folder2
我想克隆在folder1
工作納入folder2
。
我會在命令提示符中鍵入什麼來執行此操作?
似乎通常當提供克隆URL而不是文件路徑時,然而在這一刻,我只是在練習並嘗試使用Git。
我想克隆從另一個目錄的回購。git克隆從另一個目錄
可以說,我有一個C:/folder1
回購和C:/folder2
我想克隆在folder1
工作納入folder2
。
我會在命令提示符中鍵入什麼來執行此操作?
似乎通常當提供克隆URL而不是文件路徑時,然而在這一刻,我只是在練習並嘗試使用Git。
cd /d c:\
git clone C:\folder1 folder2
對於本地存儲庫,也git的原生支持,可使用以下語法:
/path/to/repo.git/ file:///path/to/repo.git/
這兩種語法大多是等價,除了前者意味着 - 本地選項。
@grahamesd,真的你不需要映射作爲一個驅動器的網絡文件夾,因爲GIT可以以這種方式克隆它的相當不錯:'git clone // pc_name/git' –
使用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.
這是因爲它看起來那麼容易。
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 #)$
如果你在你的路徑有空間,把它包在雙引號:
$ git clone "//serverName/New Folder/Target" f1/
這些都不爲我工作。我在Windows上使用git-bash。 發現問題出在我的文件路徑格式。
WRONG:
git clone F:\DEV\MY_REPO\.git
正確:
git clone /F/DEV/MY_REPO/.git
這些命令從要回購的文件夾出現在文件夾中進行
以下命令在bash中工作:git clone F:\ DEV \ MY_REPO –
值得一提的是,命令工作同樣在Linux上:
git clone path/to/source/folder path/to/destination/folder
我使用Git的bash中的windows最簡單的方法是改變路徑地址有斜槓:
git clone C:/Dev/proposed
P.S: 開始在目標文件夾中的混帳的bash。在克隆使用
路徑---> C:/開發/建議
在Windows原始路徑---> C:\開發\提出
您可以用'git的克隆C:\文件夾1 \ .git文件夾2「。您需要從您想要folder2出現的目錄運行它 –
如果您在Windows中並且它仍然無法工作,則可能需要在文件庫路徑中加上'file:\\'。看到這個https://stackoverflow.com/questions/37422428/git-internal-error-refs-remotes-origin-master-is-not-a-valid-packed-reference –