【git】Ubuntu作業系統上安裝Git LFS

代码诠释的世界發表於2024-06-12

一、場景

簡單來講、這玩意就是下載大檔案用的

二、官網

https://www.atlassian.com/git/tutorials/git-lfs#what-is-git-lfs

三、安裝

curl -s https://packagecloud.io/install/repositories/github/git-lfs/script.deb.sh | sudo bash
sudo apt-get install git-lfs
git lfs install

四、用法

使用git lfs --help

EXAMPLES
       To get started with Git LFS, the following commands can be used.

        1. Setup Git LFS on your system. You only have to do this once per
           user account:

               git lfs install

        2. Choose the type of files you want to track, for examples all ISO
           images, with git-lfs-track(1):

               git lfs track "*.iso"

        3. The above stores this information in gitattributes(5) files, so
           that file needs to be added to the repository:

               git add .gitattributes

        4. Commit, push and work with the files normally:

               git add file.iso
               git commit -m "Add disk image"
               git push

常用命令

  • 顯示當前被 lfs 追蹤的檔案列表
git lfs ls-files 
  • 檢視現有的檔案追蹤模式
git lfs track 
  • 取消 git lfs 對某檔案的追蹤
git lfs untrack "\*xx.a" 
  • 檢視當前 git lfs 版本
git lfs version 
  • 取消 LFS 的全域性配置
git lfs uninstall

參考連結:

https://zhuanlan.zhihu.com/p/623818862

https://www.atlassian.com/git/tutorials/git-lfs#what-is-git-lfs

相關文章