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

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM