git-lfs 사용하기 (대용량 파일 첨부)

부가 설명
100MB가 넘으면 Push reject되므로 git-lfs 써야함 - 필요 예시) 네이버 지도 SDK (160MB)
Tags
git-lfs

git-lfs 설치

# git-lfs 설치 $ brew install git-lfs # 필요한 프로젝트 경로로 이동하여 git-lfs 적용 $ git lfs install

대용량 파일 적용

 
retroactively migrate existing large files into Git LFS in order to decrease the size of your Git push.
$ git lfs migrate import --include="/path/to/file" # 예시 # $ git lfs migrate import --include="*.obj"
 

적용 예시

  • 네이버 지도 SDK를 썼더니 160MB가 넘는다고 push reject 됨.
  • git-lfs install 했음에도 동일한 에러가 발생함.

git push 에러 메세지

haneojin@hanui-MacBookAir DivingProject-Mobile % git push origin feat-schedule-add-Where 오브젝트 나열하는 중: 553, 완료. 오브젝트 개수 세는 중: 100% (553/553), 완료. Delta compression using up to 8 threads 오브젝트 압축하는 중: 100% (344/344), 완료. 오브젝트 쓰는 중: 100% (502/502), 77.33 MiB | 5.06 MiB/s, 완료. Total 502 (delta 146), reused 209 (delta 76), pack-reused 0 remote: Resolving deltas: 100% (146/146), completed with 39 local objects. remote: error: GH001: Large files detected. You may want to try Git Large File Storage - https://git-lfs.github.com. remote: error: Trace: 088cadf04f324ec6044ac4745ca905fc163dbcf7fb299e8fecb56bce36b36bd0 remote: error: See http://git.io/iEPt8g for more information. remote: error: File ios/Pods/NMapsMap/framework/NMapsMap.framework/NMapsMap is 160.15 MB; this exceeds GitHub's file size limit of 100.00 MB To https://github.com/nightohl/DivingProject-Mobile.git ! [remote rejected] feat-schedule-add-Where -> feat-schedule-add-Where (pre-receive hook declined) error: 레퍼런스를 'https://github.com/nightohl/DivingProject-Mobile.git'에 푸시하는데 실패했습니다

해결 예시

$ git lfs migrate import --include="NMapsMap" migrate: override changes in your working copy? [Y/n] Y migrate: changes in your working copy will be overridden ... migrate: Fetching remote refs: ..., done. migrate: Sorting commits: ..., done. migrate: Rewriting commits: 100% (1/1), done. feat-schedule-add-Where 642c906296a23e782f892341192159fe4fe79d9c -> 494e8bd676a9769ecf63f7825a46cb9cd0761eab migrate: Updating refs: ..., done. migrate: checkout: ..., done. $ git push origin feat-schedule-add-Where Uploading LFS objects: 100% (97/97), 169 MB | 4.8 MB/s, done. 오브젝트 나열하는 중: 554, 완료. 오브젝트 개수 세는 중: 100% (554/554), 완료. Delta compression using up to 8 threads 오브젝트 압축하는 중: 100% (345/345), 완료. 오브젝트 쓰는 중: 100% (503/503), 1018.97 KiB | 16.43 MiB/s, 완료. Total 503 (delta 135), reused 207 (delta 75), pack-reused 0 remote: Resolving deltas: 100% (135/135), completed with 39 local objects. remote: remote: Create a pull request for 'feat-schedule-add-Where' on GitHub by visiting: remote: https://github.com/nightohl/DivingProject-Mobile/pull/new/feat-schedule-add-Where remote: To https://github.com/nightohl/DivingProject-Mobile.git * [new branch] feat-schedule-add-Where -> feat-schedule-add-Where