django 앱을 깃헙에 전체 올리려고 하는데 지난 번, large size 파일이 있어서 불가능했다.
그때 뭔가 한참 꼬인 걸 알고 있었으나..
시간에 쫓겨 개발하고 있어서 그냥 기능 먼저 구현하고 나중에 해결하자!
라는 생각으로 진행했다.
근데 이제 aws에도 올려야 될 때가 가까워진 것 같기도 하고,,
매번 손수 ^^ 코드 수정하는 것도 컴공스럽지 않은 것 같아서 드디어 이슈를 해결해보고자 했다.
근데 생각보다 정말 오래 걸렸다.
깃헙 너란 녀석.. 꽤나 복잡하구나
우선, 내 문제는 딥러닝 모델 사이즈가 170MB에 가까운 파일이 기존 django 폴더에 들어있었다는 점인데,
그 때 깃헙이 large file에 100MB 제한이 있는 줄 몰랐다.
그때 해당 파일을 push하려고 했던 기록이 history에 남아서 계속 문제가 되었다.
$ git filter-branch --force --index-filter "git rm --cached --ignore-unmatch mytestsite/saved_models/u2net/u2net.pth" --prune-empty --tag-name-filter cat -- --all
$ echo 'u2net.pth' >> .gitignore
$ git add .gitignore
$ git commit -m "git ignore file"
$ git push origin --force --all
REFERNCE
1. Git 도큐먼트. git filter branch 부분 참고
docs.github.com/en/github/authenticating-to-github/removing-sensitive-data-from-a-repository
Removing sensitive data from a repository - GitHub Docs
Removing sensitive data from a repository If you commit sensitive data, such as a password or SSH key into a Git repository, you can remove it from the history. To entirely remove unwanted files from a repository's history you can use either the git filter
docs.github.com
2. Dealing with large files. Git LSF
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
3. git remote remove. 깃 연결 끊는 방법
[Git] 원격 저장소 연결 및 끊기 ( git remote )
깃(GIt) 사용시 현재 로컬 저장소(local repository)에 연결되어 있는 원격 저장소(remote repository)를 연결을 끊고 다시 연결 하는 방법을 간단히 포스팅 합니다. 먼저 git remote -v 명령어를 사용하여 현재
ifuwanna.tistory.com
'Git 사용법' 카테고리의 다른 글
스프링부트 프로젝트 깃헙 연결하기 (1) | 2023.11.19 |
---|---|
SSH Key 등록하기 (0) | 2023.11.19 |
Github student pack [학생팩 등록하기] (0) | 2021.03.22 |
git stash (0) | 2021.03.22 |
윈도우에서 git 사용법 정리 (0) | 2021.01.31 |
댓글