git lfs的安装和使用详细案例

本文详细介绍了如何使用 Git LFS(Large File Storage)进行大文件的上传和下载操作,包括安装配置、跟踪特定类型文件、添加及提交更改、推送至远程仓库,以及从远程仓库克隆包含大文件的项目。

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

#------------------------------------- 下面是安装部分-------------------------------------------------

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

apt-get install -y --allow-unauthenticated git-lfs

#------------------------------------- 下面是上传部分-------------------------------------------------

然后普通用户下:

git lfs install

 

找个100MB以上的大文件Adobe_Premiere_Pro_CC.7z.

 

(python3.6) appleyuchi@ubuntu:RSNA_MODEL$ git lfs track "*.7z"
Tracking "*.zip"
(python3.6) appleyuchi@ubuntu:RSNA_MODEL$ git add .gitattributes
(python3.6) appleyuchi@ubuntu:RSNA_MODEL$ git add Adobe_Premiere_Pro_CC.7z 
(python3.6) appleyuchi@ubuntu:RSNA_MODEL$ 
(python3.6) appleyuchi@ubuntu:RSNA_MODEL$ git commit -m "Add design file"
[master (root-commit) 2ed950e] Add design file
 2 files changed, 1 insertion(+)
 create mode 100644 .gitattributes
 create mode 100755 Adobe_Premiere_Pro_CC.7z
(python3.6) appleyuchi@ubuntu:RSNA_MODEL$ git push origin master
Locking support detected on remote "origin". Consider enabling it with:
  $ git config lfs.https://git.coding.net/appleyuchi/RSNA_MODEL.git/info/lfs.locksverify true
Enumerating objects: 4, done.
Counting objects: 100% (4/4), done.
Delta compression using up to 8 threads
Compressing objects: 100% (3/3), done.
Writing objects: 100% (4/4), 160.32 MiB | 1.31 MiB/s, done.
Total 4 (delta 0), reused 0 (delta 0)
To https://git.coding.net/appleyuchi/RSNA_MODEL.git
 * [new branch]      master -> master

#------------------------------------- 下面是clone-------------------------------------------------

(python3.6) appleyuchi@ubuntu:RSNA_MODEL$ git clone https://coding.net/u/appleyuchi/p/RSNA_MODEL
Cloning into 'RSNA_MODEL'...
warning: redirecting to https://git.coding.net/u/appleyuchi/p/RSNA_MODEL/
remote: Enumerating objects: 4, done.
remote: Counting objects: 100% (4/4), done.
remote: Compressing objects: 100% (3/3), done.
Unpacking objects:  75% (3/4)   
remote: Total 4 (delta 0), reused 0 (delta 0)

Unpacking objects: 100% (4/4), done.

 

最后会发现文件被顺利下载了。

目前已经405了

用法参考[1],似乎现在只有付费的用户才支持了。

#----------------------------------------------------------------------------------------------

补充:

上述方法在github通过,

coding经过上面的测试,已经变成付费的了。

gitee根据[2]中开发人员的回复,目前只能是付费企业才支持lfs

Reference:

[1]https://coding.net/git/lfs

[2]https://gitee.com/oschina/git-osc/issues/ILIZL?from=project-issue

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值