현상관리(svn, git)/설치, 명령어

[git] 깃헙 repo를 로컬에 가져오기 - 커맨드

Mary's log 2024. 9. 1. 01:49

* git bash 실행

* 탐색기,Finder에서 localProject2 생성

* 커맨드 : mkdir localProject2

* localProject2로 경로이동 : 커맨드 $ cd /c/localProject2

* 보안 상의 이유로 숨겨진 .git를 조회하려면

Window :  탐색기\보기\숨긴항목 체크

Mac       :   Finder\ Shift + cmd + .


- github.com 가져올 repository 의 https 주소를 복사한다.

 

- 현재 경로에 가져오고 싶은 repository를 clone

repository이름이 최상위 폴더명이 되어서 생성되고

(github.com repository 이름이 'localProject'면 > 로컬 해당 경로에 localProject 폴더 생성)

하위 경로에 master[default] 브랜치의 파일들을 가져온다

abc123@DESKTOP-12342V MINGW64 /c/localProject2

$ git clone https://github.com/abc123/localProject.git
Cloning into 'localProject'...
remote: Enumerating objects: 8, done.
remote: Counting objects: 100% (8/8), done.
remote: Compressing objects: 100% (5/5), done.
remote: Total 8 (delta 1), reused 7 (delta 0), pack-reused 0 (from 0)
Receiving objects: 100% (8/8), done.
Resolving deltas: 100% (1/1), done.

 

 

- 현재 경로에 repository의 특정 branch를 clone

$ git clone --branch <branchname> <remote-repo-url>
$ git clone -b <branchname> <remote-repo-url>

$ git clone -b secondBranch https://github.com/abc123/localProject.git
Cloning into 'localProject'...
remote: Enumerating objects: 8, done.
remote: Counting objects: 100% (8/8), done.
remote: Compressing objects: 100% (5/5), done.
remote: Total 8 (delta 1), reused 7 (delta 0), pack-reused 0 (from 0)
Receiving objects: 100% (8/8), done.
Resolving deltas: 100% (1/1), done.

 

 

 

 

 

 

 

 

 

 

 

참고 문헌