GitHub 대용량 Push 문제 해결

GitHub에 대용량 파일을 Push 할 때 발생하는 문제를 해결한다.

Problem

기존 Git 저장소를 GitHub에 Migration 할 때, 한번에 2GB 이상, 한 파일당 100MB 이상의 파일을 Push 하려고 하면 거부되며, 아래와 같은 에러 메시지를 볼 수 있다.

remote: error: GH001: Large files detected. You may want to try Git Large File Storage - https://git-lfs.github.com.
remote: error: Trace: 00e28c536177c44a0d5eae**********
remote: error: See http://git.io/iEPt8g for more information.
remote: error: File your-lar-file is 181.94 MB; this exceeds GitHub's file size limit of 100.00 MB
remote: fatal: pack exceeds maximum allowed size
fatal: the remote end hung up unexpectedly

Solution

Commit을 나눠서 Push

git push origin master~10000:refs/heads/master
git push origin master:refs/heads/master
git push origin refs/heads/*
git push origin --tags

Commit 로그에서 용량이 큰 파일 삭제

BFG Repo-Cleaner 사용

  • https://rtyley.github.io/bfg-repo-cleaner/

Warning: 파일이 삭제 된 Commit의 hash 값이 변경된다.

e.g. Commit 로그에서 100MB 이상의 파일을 삭제

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

태그: ,

카테고리:

업데이트: