Git

Git 사용해보기 03. 100MB 이상 파일 lfs 사용해보기

2022. 8. 5. 16:54

github에선 100MB 이상의 대용량 파일을 올리려 하면 에러가 난다.
이를 위해 친절한 github는 LS 라는 것을 배포하였다.
LFS란 크기가 큰 파일을 다루기 위해서 github에서 제공하는 오픈소스이며,
용량이 큰 파일, 혹 binary 파일들을 별도로 관리하도록 한다.

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

 

Git Large File Storage

Git Large File Storage (LFS) replaces large files such as audio samples, videos, datasets, and graphics with text pointers inside Git, while storing the file contents on a remote server like GitHub.com or GitHub Enterprise.

git-lfs.github.com

 

Download 를 한다. 자세한 정보는 아래의 링크에서 확인한다.

https://github.com/git-lfs/git-lfs/releases/tag/v3.2.0

 

Release v3.2.0 · git-lfs/git-lfs

This release is a feature release which includes support for machine-readable formats for a couple more commands, plus the ability to automatically merge LFS-based text files from the command-line....

github.com

다운로드를 실행하면 아래와 같은 화면이 나온다.

Next 를 누르면 별다른 일 없이 설치가 완료된다.

git bash 를 사용하였는데, 

git lfs install

명령어를 통해 lfs 를 설치해준다.

*만약 계속 similar command :  flow 어쩌구 에러를 보여주고 있다면 git bash 를 다시 실행하여 해보자.

 

git lfs track "TRACKING File or *.extension"

명령어를 통해 내가 tracking 할 파일을 등록해본다.

잘 등록이 되었다.

확인하는 방법은 

ls -al

위 명령어를 날려본다.

.gitattributes 파일이 생성됨을 볼 수 있다.

vi .gitattributes

위 명령어로 내용을 확인 할 수 있다.

잘 등록이 되었다.

만약 추적을 해제하고 싶다면

git lfs untrack [Tracking File or *.extension]

명령어를 통해 해제 할 수도, 직접 파일 안의 내용을 지워서 track을 해제 할 수 있다.