리눅스

git clone 디렉토리 지정 및 변경 방법

변군이글루 2021. 1. 25. 15:04
반응형

git clone 디렉토리 지정 및 변경 방법

git clone 명령어로 저장소를 복제할 때 복제된 디렉토리 경로를 지정하거나 변경할 수 있습니다.

1. 디렉토리를 미리 생성하고 복제하기

mkdir my_project
cd my_project
git clone <repository_url>

2. 복제 시 바로 디렉토리 이름 지정하기

git clone 명령어에서 목적지 디렉토리 이름을 직접 지정할 수 있습니다.

git clone <repository_url> <destination>
git cloen https://github.com/anti1346/project1.git project
Cloning into 'project'...
remote: Enumerating objects: 64, done.
remote: Counting objects: 100% (64/64), done.
remote: Compressing objects: 100% (42/42), done.
remote: Total 64 (delta 19), reused 38 (delta 9), pack-reused 0
Unpacking objects: 100% (64/64), done.
$ ls -l
합계 0
drwxr-xr-x 3 root root 90  1월 25 14:59 project

3. -o 또는 --origin 옵션 사용하기

-o 또는 --origin 옵션으로 원격 저장소 이름을 변경할 수도 있습니다. 기본값은 origin입니다.

git clone -o new_origin <repository_url> <destination_directory>
git clone -o upstream https://github.com/anti1346/project1.git project

 

728x90
반응형