다른 디렉토리에서 git clone 할 folder1에

다른 디렉토리에서 저장소를 복제하려고합니다.

나는 하나 개의 repo가 있다고 가정하자 C:/folder1C:/folder2

나는의 작품을 복제 할 folder1folder2.

이를 위해 명령 프롬프트에 무엇을 입력합니까?

종종 URL을 복제 할 때 파일 경로 대신 URL이 제공되는 것처럼 보이지만, 지금은 Git을 사용하고 연습하려고합니다.



답변

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

설명서에서git clone :

git에서 기본적으로 지원하는 로컬 리포지토리의 경우 다음 구문을 사용할 수 있습니다.

/path/to/repo.git/

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

이 두 구문은 전자가 –local 옵션을 암시한다는 점을 제외하면 대부분 동일합니다.


답변

이 중 어느 것도 나를 위해 일하지 않았습니다. Windows에서 git-bash를 사용하고 있습니다. 파일 경로 형식에 문제가 있음을 알았습니다.

잘못된:

git clone F:\DEV\MY_REPO\.git

옳은:

git clone /F/DEV/MY_REPO/.git

이 명령은 repo 폴더를 표시 할 폴더에서 수행됩니다.


답변

이 명령은 Linux에서 비슷하게 작동한다는 것을 언급 할 가치가 있습니다.

git clone path/to/source/folder path/to/destination/folder


답변

보기만큼 쉽습니다.

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/


답변

사용하다 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.


답변

Windows에서 git-bash를 사용하고 있습니다. 가장 간단한 방법은 슬래시가 있도록 경로 주소를 변경하는 것입니다.

git clone C:/Dev/proposed

추신 : 대상 폴더에서 git-bash를 시작하십시오.

클론에서 사용되는 경로 —> c : / Dev / proposed

Windows의 원래 경로 —> c : \ Dev \ proposed