[Github/LFS(+bfg)] 오류 해결 Error: GitHub's file size limit of 100.00 MB

나라·2024년 5월 21일
0

Trouble Shooting

목록 보기
13/14

개요

  • 프로젝트 중간에 video 영상이 추가됨
  • Github 파일 크기 제한인 100MB 용량을 초과하는 영상이어서 원격 저장소에 push가 되지 않는 상황
  • 에러 내용
emote: error: Trace: ...
remote: error: See https://gh.io/lfs for more information.
remote: error: File 파일명.mp4 is 127.61 MB; this exceeds GitHub's file size limit of 100.00 MB
remote: error: GH001: Large files detected. You may want to try Git Large File Storage - https://git-lfs.github.com.
To https://github.com/프로젝트레포명.git
 ! [remote rejected] feat -> feat (pre-receive hook declined)
error: failed to push some refs to 'https://github.com/프로젝레포명.git'
  • 알려진 해결 방법으로는 LFS (Git Large File Storage)를 사용하면 된다지만, 이미 대용량 파일이 포함된 채로 커밋 이력이 존재할 경우에는 알려진 방법이 통하지 않는다
  • 이 때에는 bfg 를 설치하여 기존 커밋 내역에서의 대용량 파일에 대한 내용을 먼저 삭제해야 한다

과정

1. install

bfg (+JRE)

bfc 설치
bfc는 java기반이므로 필요시 JRE(Java 런타임 환경)도 설치해준다

2. terminal

다운받은 bfc 파일을 프로젝트 루트 폴더에 넣고 터미널을 연다

java -jar bfg-1.14.0.jar --strip-blobs-bigger-than 100M

(1.14.0 자리에는 본인이 다운받은 버전 입력)

본인의 경우에는 위 명령어를 입력하니

Warning : no large blobs matching criteria found in packfiles - does the repo need to be packed?
Please specify tasks for The BFG :
bfg 1.14.0
Usage: bfg [options] [<repo>]
.
.
.

와 같은 오류가 떴다
이럴 땐

git repack 
git gc
java -jar bfg-1.14.0.jar --strip-blobs-bigger-than 100M

git repack && git gc 후에 다시 명령어를 입력하면 정상 처리된다

3. LFS

bfc를 이용해 과거 커밋 내역에서의 대용량 파일에 대한 내용을 제거했으니
다시 lfs 설정으로

git lfs install
git lfs track "file path"
git add .
git commit -m "Add large video file tracked by Git LFS"
git push origin 브랜치명

[참고 사이트]
https://git-lfs.com/
https://wooono.tistory.com/284

profile
FE Dev🔥🚀

0개의 댓글