C#/기술 개발

GitHub 100MB 이상 파일 올리다가 Push 실패시 해결책

sheepone 2021. 5. 11. 11:34
반응형

방법 #1

1. 히스토리에서 해당 파일전까지 Undo commit

우클릭후 Undo commit...

 

2. Changes로 이동후 해당 파일 우클릭후 Discard changes...

이외 정상 파일들은 다시 commit

 

방법 #2

BFG Repo-Cleaner 적용

기존 Commit에서 100MB보다 큰 파일의 로그를 강제로 없애줘야 한다.

BFG Repo-Cleaner — BFG Repo-Cleaner  를 이용하면 그 작업을 손쉽게 적용할 수 있다.

 

1. 다운로드

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

 

BFG Repo-Cleaner by rtyley

$ bfg --strip-blobs-bigger-than 100M --replace-text banned.txt repo.git an alternative to git-filter-branch The BFG is a simpler, faster alternative to git-filter-branch for cleansing bad data out of your Git repository history: Removing Crazy Big Files Re

rtyley.github.io

공식 사이트에서 bfq-x.x.x.jar — x.x.x는 버전 을 받고, 대상이 되는 폴더에 복사

Repository에서 다음과 같이 그동안의 Commit에 포함된 100MB 이상의 파일을 정리하는 명령을 실행한다.

 

2. 명령어 수행

해당 폴더에서 마우스 우클릭 Git bash here 클릭하여 명령창 생성

$ java -jar bfg-x.x.x.jar --strip-blobs-bigger-than 100M

(x.x.x에는 다운받은 파일명과 같은 이름을 입력)

 

정상일때 아래와 같은 결과

Deleted files

    — — — — — — -

    Filename Git id

    — — — — — — — — — — — — — — 

    ***.exe | c304fcfb (120.9 MB)

 

3. 오류 발생시

간혹 다음과 같은 오류가 나타날 수 있다.

 

$ java -jar bfg-x.x.x.jar --strip-blobs-bigger-than 100M

 

오류 발생시 아래와 같은 결과

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

Scanning packfile for large blobs: 132

Scanning packfile for large blobs completed in 13 ms.

Warning : no large blobs matching criteria found in packfiles — does the repo need to be packed?

Please specify tasks for The BFG :

bfg x.x.x

 

그럴 땐 아래 명령을 먼저 수행하고 다시 위의 bfg-x.x.x.jar에 의한 명령을 실행한다.

$ git repack && git gc

 

기타. Git bash here가 없을때는 아래에서 Git 설치 필요

https://git-scm.com/download/win

 

Git - Downloading Package

Download for Windows Click here to download the latest (2.36.1) 32-bit version of Git for Windows. This is the most recent maintained build. It was released about 1 month ago, on 2022-05-09. Other Git for Windows downloads Standalone Installer 32-bit Git f

git-scm.com

 

반응형