프론트엔드 개발

remote repository 하위 항목 clone 본문

Front-End/git

remote repository 하위 항목 clone

태나미 2021. 8. 11. 03:03
next-iron-session을 공부하고 있는데, 하위 폴더 examples의 next-typescript 폴더만 clone하고 싶었어요.
이처럼 github에서 특정 폴더만 clone하고 싶어서 구글링을 하였습니다. 공부하는겸 공유하는겸 올렸어요 ~~~~ 출처는 마지막에 있습니다 ~

제가 원하는 next-typescript의 경로

1. git 연결

(1) 폴더만들기

mkdir next-typescript

(2) 폴더로 이동

cd next-typescript

(3) git init 하기

git init

2. git 저장소 연결

git remote add origin 저장소주소

git remote add origin https://github.com/vvo/next-iron-session.git

3. git sparse checkout 활성화

git config core.sparsecheckout true

4. clone 하기 위한 폴더 경로 설정

echo 폴더경로/* >> .git/info/sparse-checkout

echo /examples/next-typescript/* >> .git/info/sparse-checkout

여기서, 주의할 점은 폴더 경로에 "" (큰따옴표)를 작성하면 pull이 작동하지 않는다고 해요 ~!!

5. pull 명령어로 해당 폴더 다운받기

git pull origin master

브런치명은 master가 아닐수도 있으니까 확인 잘해주세요!!

 

출처: https://velog.io/@byjihye/git-clone

 

Comments