git lfs

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

1.从这个网址下载git-lfs-windows-amd64-1.1.0.exe,运行这个安装包

 

2.然后打开git bash

输入git lfs install

 

3.根据需求来处理大文件

$ git lfs track "*.wav"
Tracking *.wav

 

$ git lfs track "*.asset"
Tracking *.asset

这2个命令会在对应的目录下生成不同的.gitattributes文件

 

5.将生成的.gitattributes文件纳入版本控制 

 

简直是给跪了,里面有2个超过10M的文件,居然push上去了

$ git push
Username for 'https://github.com': chucklu
Password for 'https://chucklu@github.com':
Counting objects: 563, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (549/549), done.
Writing objects: 100% (551/551), 29.73 MiB | 74.00 KiB/s, done.
Total 551 (delta 197), reused 0 (delta 0)
To https://github.com/chucklu/Tanks-Tutorial.git
6f935a1..121b1ee master -> master

 

6.

最新的版本安装,需要使用Choco

https://github.com/git-lfs/git-lfs#getting-started

  • Windows users can install from Chocolatey with choco install git-lfs.

似乎被墙了,直接去release界面,下载对应的安装包。

然后去C:\Program Files\Git LFS目录,替换掉对应的exe

 

7.如果之前某一个版本对文件追踪了,后续想要git push -f回滚的时候

Remote "origin" does not support the LFS locking API. Consider disabling it with:
$ git config 'lfs.http://lujuntao@192.168.1.91:8080/r/CSharp/IntelligentBuilding.git/info/lfs.locksverify' false

 

配置过后

$ git push -f
Total 0 (delta 0), reused 0 (delta 0)
To http://192.168.1.91:8080/r/CSharp/IntelligentBuilding.git
! [rejected] master -> master (non-fast-forward)
error: failed to push some refs to 'http://lujuntao@192.168.1.91:8080/r/CSharp/IntelligentBuilding.git'
hint: Updates were rejected because the tip of your current branch is behind
hint: its remote counterpart. Integrate the remote changes (e.g.
hint: 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.

 

 

8.如果git clone之后才安装git lfs,而clone的版本库是用lfs的,那么需要git lfs fetch或者pull

 

作者:Chuck Lu    GitHub    
posted @   ChuckLu  阅读(3716)  评论(0编辑  收藏  举报
编辑推荐:
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
· 理解Rust引用及其生命周期标识(上)
· 浏览器原生「磁吸」效果!Anchor Positioning 锚点定位神器解析
· 没有源码,如何修改代码逻辑?
阅读排行:
· 全程不用写代码,我用AI程序员写了一个飞机大战
· DeepSeek 开源周回顾「GitHub 热点速览」
· MongoDB 8.0这个新功能碉堡了,比商业数据库还牛
· 记一次.NET内存居高不下排查解决与启示
· 白话解读 Dapr 1.15:你的「微服务管家」又秀新绝活了
历史上的今天:
2012-11-28 异步Socket的完美代码[使用Async实现]
点击右上角即可分享
微信分享提示