๋ณธ๋ฌธ ๋ฐ”๋กœ๊ฐ€๊ธฐ
๊ฐœ๋ฐœ์ƒํ™œ/Git

github git-lfs ์‚ฌ์šฉ ๋Œ€์šฉ๋Ÿ‰ ํŒŒ์ผ ์—…๋กœ๋“œ

by cocococo331 2024. 8. 15.

๊นƒํ—ˆ๋ธŒ ํŒŒ์ผ ์—…๋กœ๋“œ ์‹œ 25๋ฉ”๊ฐ€ ์šฉ๋Ÿ‰ ์ œํ•œ์ด ์žˆ์Œ 

git-lfs ์ด์šฉํ•ด์„œ ์—…๋ฐ์ดํŠธ ํ•„์š”

 

์ฃผ์˜ ์‚ฌํ•ญ

์˜ฌ๋ฆฌ๋Š” ์‚ฌ๋žŒ๋„ ๋ฆฌํฌ๋ฅผ ํด๋ก  ๋ฐ›๋Š” ์‚ฌ๋žŒ๋„ ๋ชจ๋‘ git-lfs๊ฐ€ ์„ค์น˜ ๋˜์–ด์žˆ์–ด์•ผํ•จ

git-lfs๊ฐ€ ์„ค์น˜๋˜์–ด์žˆ์ง€ ์•Š์€ PC์—์„œ lfs๋กœ ์—…๋กœ๋“œํ•œ ํŒŒ์ผ์„ ๋‹ค์šด๋ฐ›์œผ๋ฉด ํฌ์ธํ„ฐ๋งŒ ๋‹ค์šด๋ฐ›์•„์ง

 

์„ค์น˜ ๋ฐ ์—…๋กœ๋“œ ๋ฐฉ๋ฒ•

1. ์„ค์น˜ : brew install git-lfs

2. lfs ์ดˆ๊ธฐํ™” : git lfs install

3. ํŒŒ์ผ ์ถ”์  ์„ค์ • : git lfs track "*.csv" ex)csvํŒŒ์ผ์„ ์ถ”์ ํ•˜๊ณ  ์‹ถ๋‹ค.

4. ํŒŒ์ผ ์ถ”๊ฐ€ ๋ฐ ์ปค๋ฐ‹

๋ฆฌํฌ์ง€ํ† ๋ฆฌ๋กœ ์ด๋™

git add .gitattributes
git add {์ด๋ฆ„}.csv
git commit -m "Add large CSV file using Git LFS"
git push origin main

 

clone์‹œ (git-lfs๋ฅผ ์„ค์น˜ํ•˜์ง€ ์•Š์€ ๋‹ค๋ฅธPC๋ผ ๊ฐ€์ •)

1. brew install git-lfs

2. git lfs install

3. git clone {repo-url}

 

lfs์ ์šฉ ์ „ ๊ธฐ์กด์— csvํŒŒ์ผ ํ‘ธ์‰ฌํ•ด๋†“์€ ๊ฒƒ ์žฌ์ฒ˜๋ฆฌ

1. git rm --cached {๊ธฐ์กด์˜ฌ๋ผ๊ฐ€์žˆ๋Š”csv์ด๋ฆ„}.csv

2. git add {๊ธฐ์กด์˜ฌ๋ผ๊ฐ€์žˆ๋Š”csv์ด๋ฆ„}.csv

3. git commit -m "๊ธฐ์กด csv lfs ์ ์šฉ"

4. git push origin main