Olive Study Room
[Github] 큰 용량의 파일 push 할 때의 에러 본문
pod을 추가하고 push하려고 하니 아래와 같은 오류가 떴다.
remote: error: trace: d87c05af04a57def40b90e7463283f0a8edfdda6ec255906297ba62be3ee97c6 remote: error: see http://git.io/iept8g for more information.
remote: error: file pods/agorartcengine_ios/agorartckit.framework/agorartckit is 209.91 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. to https://github.com/team-iteam-it/iteam.git ! [remote rejected] add -> add (pre-receive hook declined) error: failed to push some refs to 'https://github.com/team-iteam-it/iteam.git'
Agora pod 파일의 용량이 100MB가 넘어서 push하지 못한다고 한다.
Github에서 push할 때 50MBqnxj Warning을 표시하고 100MB부터 에러가 발생한다고 한다.
이를 해결하기 위해 다양한 방법이 있었다.
1. HTTP 버전 변경
git config --global http.version HTTP/1.1
git push
git config --global http.version HTTP/2
HTTP 버전을 1.1 만든 후 push하고 버전 2로 다시 전환해준다. HTTP 1.1에서는 파일 전송 크기가 더 크거나 제한을 두지 않는 듯 했다.
enumerating objects: 2565, done. counting objects: 100% (2565/2565), done.
delta compression using up to 12 threads compressing objects: 100% (2414/2414), done.
error: rpc failed; curl 92 http/2 stream 0 was not closed cleanly: cancel (err 8) fatal: the remote end hung up unexpectedly | 125.00 kib/s
writing objects: 100% (2558/2558), 104.80 mib | 2.88 mib/s, done.
total 2558 (delta 1078), reused 41 (delta 5) fatal: the remote end hung up unexpectedly everything up-to-date
push error: rpc failed; curl 18 transfer closed with outstanding read data remaining send-pack: unexpected disconnect while reading sideband packet
새로운 에러가 뜨며 해결되지 않았다. 이 역시 찾아보니 용량이 크다는 것 같았다.
그래서 그냥 용량을 줄여주기로 했다.
2. Large File Storage
Git LFS는 대용량 파일을 별도의 서버에 올리고 원래 위치에는 포인터를 남기는 방식으로 파일 크기를 줄여준다.
LFS 다운로드
brew install git-lfs
적용하는 레포 위치에서 LFS를 사용 선언하고 트랙킹할 파일을 선택했다. 내 경우는 pods 파일 내부의 파일들을 모두 tracking 해줬다.
그 이전에 해당 파일을 기존의 git tracking에서 제외해줘야한다. 어차피 gitignore도 수정해줘야 했어서 파일 전체의 tracking을 제거해줬다.
git lfs install // lfs 다운
git rm -r --cached . // 트래킹 모두 삭제
git lfs track "pods/**" // pods 하위 파일들 모두 tracking
하지만 gitignore와 트래킹부분에서 차이가 있었는지 원하는대로 tracking되지 않았다.
3. gitignore
결국.. 그냥 gitignore에 pods를 추가해서 pod파일을 올리지 않기로 했다. 작은 프로젝트라서 그냥 pod파일까지 올려서 상관없겠다 했는데.. 결국 이렇게 진행했다.
git rm -r --cached . // 다시 트래킹 모두 삭제
// ignore 수정~~
git add .
git commit -m "[Hotfix] git ignore 수정"
=> pod 파일을 굳이 레포에 포함시킬 필요가 없을 때는 포함시키지 말고 ignore 해주자!