Skip to content

Instantly share code, notes, and snippets.

@dsdanielpark
Last active March 2, 2023 02:30
Show Gist options
  • Save dsdanielpark/392803c06c043a913961db0c840d06df to your computer and use it in GitHub Desktop.
Save dsdanielpark/392803c06c043a913961db0c840d06df to your computer and use it in GitHub Desktop.
usage of git-lfs

git-lfs

What is git-lfs??

git-lfs is kinda of pointer hash which has infomation about file address of cloud data stroage.

  • You can uploade and manage revision of large file (>100MB)
  • git-lfs give you 1GB for free, and you can upload 1.5GB (If you use over 1.5GB, git-lfs will be locked until you pay for it.)

For more infomations
[1] https://git-lfs.com/
[2] http://arfc.github.io/manual/guides/git-lfs

Install

Linux(Debian): apt-get install git-lfs
Linux(Red Hat): yum install git-lfs
macOS(brew): brew install git-lfs
Windows: https://git-scm.com/docs/git-commit

Quick Start

# In repository dir
$ git lfs install

# Remove cached file that you want to uploade to git-lfs  
$ git rm --cached (file path)

# Add file to git-lfs
$ git lfs track (file path)

# Then you see the file path in `.gitattributes`
# Commit and Push

If you want to delete file in git-lfs then uninstall and re-install in repo

$ git lfs uninstall

Q. 용량 초과로 Git LFS disabled 메일을 받았을 경우

  1. 레포지토리 삭제
  2. 초기화git add --renormalize .
  3. https://docs.github.com/en/repositories/working-with-files/managing-large-files/removing-files-from-git-large-file-storage
  4. git-lfs uninstall하고 git에서 파일관련된 거 지워서 트랙된거 다 제거 후에 다시 git-lfs 설정 (삭제 후 track): git-lfs도 large file에 대한 리비전 관리를 목적으로 하므로, 파일 변경시 용량이 계속 축적되므로 1.5GB 금방 넘으니까 마지막에 1GB 내외의 파일만 한번에 업데이트 추천

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment