Jul.20.21(2)

iissaacc·2021년 7월 21일
0

TIL

목록 보기
2/10

Prologue

자꾸 프로젝트 업로드를 거부당하는 이유가 .md파일 말고 하나 더 있었다.

What was it?

프로젝트 파일에 100M가 넘는 파일이 문제였다. 깃헙에는 정책상 100M가 넘는 파일은 업로드를 못 하게 돼있다. 시도를 하면 이런 경고를 볼 수 있다.

Counting objects: 3086, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (2980/2980), done.
Writing objects: 100% (3086/3086), 363.25 MiB | 935.00 KiB/s, done.
Total 3086 (delta 1236), reused 111 (delta 57)
remote: error: GH001: Large files detected. You may want to try Git Large File Storage — https://git-lfs.github.com.
remote: error: Trace: ***
remote: error: See http://git.io/iEPt8g for more information.
remote: error: File *** is 120.94 MB; this exceeds GitHub’s file size limit of 100.00 MB
To git@github.com:***
 ! [remote rejected] main -> main (pre-receive hook declined)
 ! [remote rejected] *** -> *** (pre-receive hook declined)
error: failed to push some refs to ‘git@github.com:***’

Frist thing's frist

용량 큰파일이 뭔지 모르겠다면 누가 범인인지 찾아보자.

$ find . -type f -size +100M
./directory/to/the/file/model.h5

내 경우엔 h5파일이었고 git lfs를 쓰면 우회적으로 업로드 할 수 있었다. lfs를 쓰면 파일 업로드는 lfs store에 하고 레포에는 포인터 파일을 남기는데 이 파일이 대용량 파일을 가리키는 원리다. 와!

그렇지만 아직까지 lfs에 올라간 파일을 지우려면 레포를 통째로 날리는 수밖에 없다는 점만 주의하면 된다.

무료계정은 1G 용량과 매달 1G bandwith가 주어지는데 쓰다 남은 bandwith는 이월되지 않는다.

How to use it?

간단하게

  • 설치 \to 파일추적 \to .gitattributes 생성

순서로 설정하면 해당프로젝트에 대해서는 lfs가 항상 대용량 파일을 추적하면서 관리해준다.

$ git lfs install
$ git lfs track "*.h5"
$ git add .gitattributes

Epliogue

되게 편하지만 1G는 덮어놓고 쓰다보면 금방 쓸 것 같은 쌔한 느낌

0개의 댓글