preloader image
Git LFS 安装及使用

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/

Copyright © 2088 暴雪游戏怀旧特刊 All Rights Reserved.
友情链接