Github에는 기본적으로 100MB 이상의 파일을 올릴 수 없다 GitHub Docs 대용량 파일 정보
100MB보다 큰 크기의 파일을 push 하려고 하면 아래와 같은 에러메시지를 보게된다
$ git push -u origin main
Enumerating objects: 7, done.
Counting objects: 100% (7/7), done.
Delta compression using up to 12 threads
Compressing objects: 100% (7/7), done.
Writing objects: 100% (7/7), 68.13 MiB | 9.34 MiB/s, done.
Total 7 (delta 0), reused 0 (delta 0), pack-reused 0
remote: error: Trace: db09fccc0ff4eedfdf0c2cc156fb4d60944b03e115161ada0215ffc483ce4840fc483ce4840
remote: error: See https://gh.io/lfs for more information. limit of 100.00 MB
remote: error: File large.mp4 is 284.24 MB; this exceeds GitHub's file sizeile Storage - https://gi 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/jimeal/LargeFileTest.git .git'
! [remote rejected] main -> main (pre-receive hook declined)
error: failed to push some refs to 'https://github.com/jimeal/LargeFile.git'
해결방법
1. Git Lfs
commit 과정에서 지정한 파일을 작게 조각내주는 Git Extension인 git-lfs를 로컬에 설치해준다
git-lfs : Git Large File Storage 설치하기
적용하려는 폴더로 이동한 후, 아래 명령어를 실행한다
$ git lfs install
용량이 큰 파일을 git-lfs 관리대상으로 등록해준다
$ git lfs track “*.exe”
그런다음 push를 실행해 주면 된다
그런데 기존의 대용량 파일을 올리려 시도한 적이 있다면 여전히 에러메시지를 보게된다.
그럴경우 큰 파일의 로그를 강제로 없애줘야 한다
2. BFG Repo Cleaner
설치하기
먼저, 다운로드를 받은 후, 다운받은 파일을 대상이 되는 폴더로 이동시킨다
그런 다음 아래 명령어를 실행해준다
java -jar bfg-x.x.x.jar --strip-blobs-bigger-than 100M (x.x.x 버전을 넣어준다)
$ java -jar bfg-1.14.0.jar --strip-blobs-bigger-than 100M
만약 다음과 같은 오류가 난다면
아래 명령어를 실행한 후 다시 시도해 본다
$ git repack && git gc
그런 다음 push를 해준다
'Git' 카테고리의 다른 글
Git 기본 명령어 (0) | 2024.03.29 |
---|---|
Git 초기설정 (0) | 2024.03.29 |