git lfs linux,GIT LFS 使用笔记

本文介绍如何在Git中使用GITLFS处理超过大小限制的文件,包括安装过程及具体使用方法。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

一、背景

由于git上传文件大小受限,所以我们需要使用GIT LFS对大小超过一定上限的大文件进行处理。

二、安装

linux上安装参见 https://askubuntu.com/questions/799341/how-to-install-git-lfs-on-ubuntu-16-04

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

sudo apt-get install git-lfs

在我的ubuntu16.04上我一直卡在第一条命令,所以我选择的是windows版GIT LFS(https://git-lfs.github.com/)

下载完git-lfs-windows-v2.5.2.exe后双击,按照步骤进行安装。然后执行 git lfs install

三、使用,参考https://blog.csdn.net/code_segment/article/details/78597416

# Add all zip files through Git LFS

$ git lfs track "*.zip"

$ git add .gitattributes

$ git add my.zip

$ git commit -m "add zip"

$ git lfs ls-files

my.zip

$ git remote add origin https://github.com/Agzs/gopath.git

$ git push origin master

在这里一定要用git lfs ls-files查看一下,我用直接track文件的方式就没有在这里显示出我要托管的文件。

来源:https://www.cnblogs.com/lucifer1997/p/9877535.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值