본문 바로가기
study/Git

원격저장소 Repository에서 특정 폴더 가져오기

by Elfen Lied 2023. 2. 8.
반응형
## 워크스페이스 전체 파일 업로드된 저장소에서 선택 프로젝트만 가져오기

받고싶은 위치에 폴더를 생성함

git init

git config core.sparseCheckout true

git remote add -f origin 원격저장소주소
// ex) git remote add -f origin https://github.com/aaaa/test.git
// -f 옵션은 --fetch와 동일한 옵션으로 remote를 연결함과 동시에 fetch를 통해 파일을 가져온다.

echo "프로젝트명/" >> .git/info/sparse-checkout
// 만약 test라는 repository의 portfolio라는 폴더를 가져오고 싶으면 "프로젝트명" 부분을 --> "portfolio/" 로 적으면 된다.
// ex) echo "portfolio/" >> .git/info/sparse-checkout

git pull origin master

 

 

 

반응형

댓글