깃허브 형상관리

[github]용량 큰 파일 올리기

소영 2021. 6. 24. 16:48

깃허브에 예전 포트폴리오를 올리려고 push를 하는데 계속 올라가지 않고.. 에러가 떴다.

remote: warning: File [파일] is 69.43 MB; this is larger than GitHub's recommended maximum file size of 50.00 MB
remote: warning: File [파일] is 55.82 MB; this is larger than GitHub's recommended maximum file size of 50.00 MB
remote: warning: File [파일] is 55.15 MB; this is larger than GitHub's recommended maximum file size of 50.00 MB
remote: warning: File [파일] is 63.32 MB; this is larger than GitHub's recommended maximum file size of 50.00 MB
remote: error: GH001: Large files detected. You may want to try Git Large File Storage - https://git-lfs.github.com.
remote: error: Trace: edc3992279cee9fd40240981e6cffa445cd9f99648b26afd3a2f54179cf8cb99
remote: error: See http://git.io/iEPt8g for more information.
remote: error: File [파일] is 176.96 MB; this exceeds GitHub's file size limit of 100.00 MB
To https://github.com/[깃허브 주소]
 ! [remote rejected] main -> main (pre-receive hook declined)

용량이 큰 파일이 있으니, 해결하고 올리라는 뜻이었다.

눈물을 머금고...

 

1. 용량이 큰 파일을 삭제하기

2. git lfs를 사용해 파일 용량을 삭제하는 방법

 

이렇게 두가지 방법을 찾았는데 , 올려야하는 파일이 중요해서 git lfs를 설치하기로 하였다. 

 

일단, 환경이 맥 os였기 때문에 홈브로우(https://brew.sh/index_ko)를 깔아주고, 터미널에 brew install git-lfs 를 작성하여 lfs를 설치한다.

깃에 올릴 폴더경로로 들어가 git-lfs install 명령어 작성

 

lfs를 설치했으면 용량 큰 파일을 조각내야 한다.

 

git lfs track "[용량 큰 파일 경로]" 로 하나씩 명령어를 작성해주면 Tracking [파일]이 된다.

파일 조각 후 git add .을 하면 완료! 일줄 알았는데.....

 

똑.같.이 오류 났다...

 

이유를 찾아보니 이미 commit을 한 상태여서 그렇다고 한다.(커밋하고 저장소에 올렸을때 오류난걸 알았기 때문에 당연한 문제...)

 

그래서 그냥 커밋 다 지우고, 깃 자체를..지우고

git init부터 다시 시작-> git lfs track "[용량 큰 파일 경로]"-> git add . -> git commit -m "커밋 로그" -> git remote add origin [내 깃허브 레파지토리 주소]-> git push -u origin main 

 

해서 용량 큰 파일 깃허브에 올리기 완료!!!!