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

 

posted @ 2015-11-28 18:08  ChuckLu  阅读(3707)  评论(0编辑  收藏  举报