본문 바로가기
공부/기타

[Git] GitHub's file size limit of 100.00 MB 에러 해결

by 로디네로 2023. 12. 1.
반응형

 

GitHub's file size limit of 100.00 MB


 

에러

 

귀찮은 에러해결 방법을 정리해놓으려고 오랜만에 포스팅을 한다.

 

에러 메시지는 아래와 같다.

remote: error: File test.mp4 is 100.1 MB; this exceeds GitHub's file size limit of 100.00 MB        
remote: error: GH001: Large files detected. You may want to try Git Large File Storage - https://git-lfs.github.com.

 

Github에 저장되는 최대 파일크기는 100MB 인듯한데

 

내 파일(test.mp4)의 크기가 무려 100.1MB 여서 push에 실패한 것이다!

 

용량이 0.1MB만 작았더라면.. 😥

 

해당 파일을 제거하고 다시 add commit push 해도 증상은 똑같았다.

 


 

해결

 

위에 나와있듯이 gif-lfs를 설치하는 방법도 있지만

 

앞으로도 100MB가 넘는 파일을 올릴것 같지 않아 아주 간단하게 이력을 제거하는 방법을 택했다.


이력을 제거 한다?

git에는 지금 파일을 지우고 commit 한다고 해도

이전에 commit 한 이력과 파일이 남아있기 때문에 똑같이 오류가 나게 된다.

아예 원천을 제거하고 지금으로 돌아와야 한다.


 

1. git status 를 확인한다

git status

 

On branch main
Your branch is ahead of 'origin/main' by 3 commits.
  (use "git push" to publish your local commits)

Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git restore <file>..." to discard changes in working directory)
	modified:   test.py

no changes added to commit (use "git add" and/or "git commit -a")

 

현재 push 되지 않은 commit 들이 3개나 있다.


 

2. 해당 파일이 포함돼있는 commit을 없애준다

git reset HEAD~0
git reset HEAD~1
git reset HEAD~2

 

앞에서부터 index 0,1,2 세개를 지워준다.

 


 

3. git status 재확인

 

git status

 

On branch main
Your branch is behind 'origin/main' by 1 commit, and can be fast-forwarded.
  (use "git pull" to update your local branch)

Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git restore <file>..." to discard changes in working directory)
	modified:   test.py

Untracked files:
  (use "git add <file>..." to include in what will be committed)
	.test/

no changes added to commit (use "git add" and/or "git commit -a")

 

아까와는 다른 메시지로 정상적으로 복구됐다.

 

여기까지 정상적으로 되면 add commit push 가 정상적으로 될 가능성이 높다.


 

4. push 시 다시 오류 발생

PS C:\Users\ssss\OneDrive\8. Git\GitHub\test> git push origin dev
To https://github.com/ssss.git
 ! [rejected]        dev -> dev (non-fast-forward)
error: failed to push some refs to 'https://github.com/ssss.git'
hint: Updates were rejected because the tip of your current branch is behind
hint: its remote counterpart. Integrate the remote changes (e.g.
hint: 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.

 

- 에러 메시지 대로 해결해본다.

- git pull

- conflict 되는 사항들 제거

- git add -> commit -> push

- 완료

 

 

 

- 끝 -

반응형

댓글