반응형
Notice
Recent Posts
Recent Comments
Link
«   2024/05   »
1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31
Archives
Today
Total
관리 메뉴

타닥타닥 민타쿠

Git LFS 깃허브 대용량(100MB) 파일 올리기 본문

개발/Git

Git LFS 깃허브 대용량(100MB) 파일 올리기

민타쿠 2021. 7. 25. 08:45
반응형

깃허브 저장소에는 용량 제한이 없지만, 파일 하나당 100메가의 제한이 있다.
따라서, 파일이 50메가만 넘어가도 warning 메시지가 뜨고,
100메가가 넘어가는 파일을 push 하려는 경우에 다음과 같은 에러 메시지가 나온다.

remote: Resolving deltas: 100% (3/3), completed with 3 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: 51efcb860cd7c76aa349c5f931ebc96bedfc30763349d284be7278a271fb56ae
remote: error: See http://git.io/iEPt8g for more information.
remote: error: File ***/***.exe is 144.19 MB; this exceeds GitHub's file size limit of 100.00 MB
To https://github.com/***/***.git
 ! [remote rejected] main -> main (pre-receive hook declined)
error: failed to push some refs to 'https://github.com/***/***.git'

50메가는 넘고 100메가는 넘지 않아 뜨는 warning 메시지는 상관 없지만,
위와 같이 100메가가 넘어서 error 메시지가 발생할 경우 메시지가 안내하는 것과 같이 Git LFS 익스텐션을 이용한 작업이 필요하다. 원리는 대용량 파일을 잘게 쪼개 관리한다는 내용이다.

해결방법

  1. Git LFS 설치(링크 : Git LFS 다운로드 페이지)
    Git LFS download page


  2. git lfs install
    - 로컬 프로젝트 경로에서 cmd 로 설치 명령을 입력한다.

  3. git lfs track "***.exe"
    - 100MB 이상의 파일을 lfs 로 관리 등록을 한다.

  4. git commit -m "메시지"
    - 다시 커밋한다.
    - 이전에 100MB 이상 파일을 커밋한 적이 없다면 이대로 push 하면 된다.

  5. BFG Repo-Cleaner 다운로드 (링크 : BFG-Repo-Cleaner 다운로드 페이지)
    - LFS 적용 이전에 100MB 이상 파일을 커밋한 적이 있다면 LFS 적용 후에도 여전히 에러 메시지가 발생하기 때문에,
    bfq-***.jar 파일의 도움을 받아 없애기 위해 다운로드한다.
    BFG Repo-Cleaner download page


  6. java -jar bfg-***.jar --strip-blobs-bigger-than 100M .git
    - 다운로드 받은 jar 파일을 로컬 프로젝트 경로로 옮기고 명령어를 실행한다.
    - 만약 아래와 같은 메시지가 나온다면,

    Using repo : C:\***\***\.git

    Scanning packfile for large blobs: 2555
    Scanning packfile for large blobs completed in 65 ms.
    Warning : no large blobs matching criteria found in packfiles - does the repo need to be packed?
    Please specify tasks for The BFG :
    bfg 1.***.0
    Usage: bfg [options] [<repo>]

    git repack && git gc 라고 명령어 입력 후, 다시 명령을 실행한다.

  7. git push
    - 이제 100MB 넘는 파일도 깃허브에 업로드 할 수 있다!

 

반응형
Comments