[git] git clone시 특정 디렉토리만 가져오기

민수·2023년 2월 18일
0
post-thumbnail

1. clone할 저장소 생성

git init project
cd project

2. 원격 저장소 추가

git remote add origin [remote_URL]

3. sparse Checkout 설정

git config core.sparseCheckout true

4. 필요한 디렉토리 지정

echo "dir" >> .git/info/sparse-checkout
echo "maindir/subdir/" >> .git/info/sparse-checkout

5. git pull

git pull origin main

추가

  • 이미 clone을 받은 상태라면 해당 디렉토리에서
  1. sparse Checkout 설정
  2. 원하는 디렉토리를 지정
  3. git pull
git config core.sparseCheckout true
echo "dir" >> .git/info/sparse-checkout
git pull origin main

참고

0개의 댓글