카테고리 없음

[Github] Git LFS로 깃허브에 100MB 넘는 파일 올리기

담곰농 2022. 5. 26. 00:23
728x90
반응형

깃허브를 사용하면 가끔 100MB 넘는 파일을 올릴 때가 있다

 

그러면 아래와 같이 에러가 발생한다

 

this exceeds Github's file size limit of 100.00MB

GH001: Large files detected. You may want to try Git Large File Storage - 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

 

이런 상황에서는 git-lfs(large file storage)를 사용해서 해결할 수 있다

 

Git LFS 설치

mac OS

brew install git-lfs

 

ubuntu

curl -s https://packagecloud.io/install/repositories/github/git-lfs/script.deb.sh | sudo bash
sudo apt install git-lfs

 

Git LFS 사용

git-lfs를 사용할 repository에서 아래 명령어를 실행해준다

git lfs install

 

이미 파일을 commit 했을 경우에는

아래 명령어를 통해 commit을 취소하고 해당 파일을 staged 상태로 바꾸어준다 (unstaged 상태로 바꾸고 add 해도 상관 없다)

git log // commit 목록 확인
git reset --soft HEAD^ // commit을 취소하고 해당 파일들은 staged 상태로

 

 

파일 commit & push

lfs로 관리할 파일을 정해준다

git lfs track 파일명
git add .gitattributes
git commit -m "커밋 메세지"
git push origin

.gitattributes를 반드시 함께 add 해주어야한다

 

Git LFS 파일 pull

다른 서버에서 git pull을 받는 경우에 해당 파일의 원본이 pull 받아지지 않는다

 

원래 pose_deploy_linevec_faster_4_stages.prototxt 파일의 경우 197MB 이다

pose_deploy_linevec_faster_4_stages.prototxt

 

git lfs pull을 통해 원본 파일을 pull 받을 수 있다

git lfs pull

 

정상적으로 197MB 파일이 pull 받아졌다

 

728x90
반응형