Git LFS 安装及使用


一、安装(Linux):#

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

其它操作系统上的安装,见官方安装文档:

https://github.com/git-lfs/git-lfs#installing

二、配置及使用#

  • 在 Git 仓库中为仓库初始化相关配置
git lfs install
  • 添加要LFS 追踪的文件

    • 添加指定后缀的文件

      git lfs track "*.zip"
      
    • 添加指定文件

      git lfs track "1.zip"
      

    这个命令会更改仓库中的 .gitattributes 配置文件 (如果之前不存在这个文件,则会自动新建):

    查看如下:

    cat .gitattributes
    
    protect/core/tools/v3.1.1.13.zip filter=lfs diff=lfs merge=lfs -text
    

    通过 git lfs ls-files命令也可查看,追踪文件列表。

    • 取消追踪文件

      git lfs untrack "1.zip"
      
  • 保存并提交配置

    git add .gitattributes
    git commit -m "add .gitattributes"
    

Git LFS 操作指南:
https://help.gitee.com/enterprise/code-manage/code-hosting/large-file-manage/git-lfs
https://docs.github.com/zh/repositories/working-with-files/managing-large-files/installing-git-large-file-storage
https://github.com/git-lfs/git-lfs#getting-started
https://zzz.buzz/zh/2016/04/19/the-guide-to-git-lfs/


posted @   就学45分钟  阅读(4304)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 全程不用写代码,我用AI程序员写了一个飞机大战
· MongoDB 8.0这个新功能碉堡了,比商业数据库还牛
· 记一次.NET内存居高不下排查解决与启示
· DeepSeek 开源周回顾「GitHub 热点速览」
· 白话解读 Dapr 1.15:你的「微服务管家」又秀新绝活了
历史上的今天:
2022-11-16 Linux centos 在线|离线安装依赖
点击右上角即可分享
微信分享提示
主题色彩