본문 바로가기

Git/에러기록

[Git] remote: error: GH001: Large files detected. You may want to try Git Large File Storage - https://git-lfs.github.com. 에러 해결

구분 버전
java java version "1.8.0_172"
git git version 2.39.1.windows.1
bfg bfg-1.14.0.jar
gif lfs 3.3.0

git lab에 올리던걸

github 에도 올리려다 발생했다.

remote: error: File polls/Nt_Pac/Nt_db/instantclient_11_2/oraociei11.dll is 135.63 MB; this exceeds GitHub's file size limit of 100.00 MB        
remote: error: File polls/Nt_Pac/Nt_db/instantclient_21_6/oraociei.dll is 208.85 MB; this exceeds GitHub's file size limit of 100.00 MB

github는 100mb 이상 전송을 못한다고 한다.

오라클 클라이언트를 과거에

포함해서 올렸던 게 문제가 되었고

친절하게 에러에도

https://git-lfs.github.com. 분할전송해서 할 수 있는

링크를 알려준다.

 

설치하려고 하니 발생하는 다른 에러..

Error message: "Not in a git repository". LFS issue on a virtual machine.

검색결과

https://github.com/git-lfs/git-lfs/issues/3934 

 

Error message: "Not in a git repository". LFS issue on a virtual machine. · Issue #3934 · git-lfs/git-lfs

Create a Virtual Machine in Azure (used a preconfigured one including VS2019) Installed GIT LFS Istalled an AzureDevOps build agent. Started a AzureDevOps build definition which clones a git repo i...

github.com

해당 이슈를 다루고 있는데 뭔 말인지 잘 모르겠어서

경로문제인가? 하고 git을 재설치하기로 했다

기존경로에 있던 git이 버전이 업데이트되고

설치문제는 해결되었다.

 

그리고 .git 이들어있는 프로젝트 폴더로 가서

명령어를 실행해 준다

1.

D:\관리프로그램\가상환경\project_final\project>git lfs install
Updated Git hooks.
Git LFS initialized.

2.

D:\관리프로그램\가상환경\project_final\project>git lfs track "*.exe"
Tracking "*.exe"

D:\관리프로그램\가상환경\project_final\project>git lfs track "*.dll"
Tracking "*.dll"

에러가난 확장자를 넣어주면 되는 거 같다.

하지만 이미 커밋한 상황에선 에러가

또 뜬다고 한다. 

과거 커밋한 이력 중 100mb 이상 로그를

없애줘야 한다고 한다.

 

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

bfg-1.14.0.jar 다운로드해서

내 프로젝트 폴더 경로에 넣어주고

아래명령어를 실행

3.

D:\관리프로그램\가상환경\project_final\project>java -jar bfg-1.14.0.jar --strip-blobs-bigger-than 100M

Using repo : D:\관리프로그램\가상환경\project_final\project\.git

Scanning packfile for large blobs: 1188
Scanning packfile for large blobs completed in 60 ms.
Found 2 blob ids for large blobs - biggest=218998272 smallest=142222848
Total size (unpacked)=361221120
Found 95 objects to protect
Found 4 commit-pointing refs : HEAD, refs/heads/master, refs/remotes/origin/main, refs/remotes/origin/master

Protected commits
-----------------

These are your protected commits, and so their contents will NOT be altered:

 * commit be908bab (protected by 'HEAD')

Cleaning
--------

Found 149 commits
Cleaning commits:       100% (149/149)
Cleaning commits completed in 2,593 ms.

Updating 2 Refs
---------------

        Ref                          Before     After
        ------------------------------------------------
        refs/heads/master          | be908bab | 41c6015c
        refs/remotes/origin/master | be908bab | 41c6015c

Updating references:    100% (2/2)
...Ref update completed in 32 ms.

Commit Tree-Dirt History
------------------------

        Earliest                                              Latest
        |                                                          |
        DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDmmm

        D = dirty commits (file tree fixed)
        m = modified commits (commit message or parents changed)
        . = clean commits (no changes to file tree)

                                Before     After
        -------------------------------------------
        First modified commit | 1927f0e7 | c3e81976
        Last dirty commit     | dc3746e0 | e5f2881a

Deleted files
-------------

        Filename         Git id
        ------------------------------------
        oraociei.dll   | 34c2d2fd (208.9 MB)
        oraociei11.dll | 73ea0c65 (135.6 MB)


In total, 618 object ids were changed. Full details are logged here:

        D:\관리프로그램\가상환경\project_final\project.bfg-report\2023-02-03\16-33-22

BFG run is complete! When ready, run: git reflog expire --expire=now --all && git gc --prune=now --aggressive

이제 커밋이 되었다!!!