• This repository has been archived on 01/Dec/2023
  • Stars
    star
    283
  • Rank 146,066 (Top 3 %)
  • Language
    Go
  • Created about 6 years ago
  • Updated about 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

git-lfs custom transfer adapter which simply uses a folder as the remote LFS media store (e.g. a shared NAS folder)

Git LFS: Shared Folder agent

Build status

What is it?

lfs-folderstore is a Custom Transfer Agent for Git LFS which allows you to use a plain folder as the remote storage location for all your large media files.

Why?

Let's say you use Git, but you don't use any fancy hosting solution. You just use a plain Git repo on a server somewhere, perhaps using SSH so you don't even need a web server. It's simple and great.

But how do you use Git LFS? It usually wants a server to expose API endpoints. Sure you could use one of the big hosting providers, but that makes everything more complicated.

Maybe you already have plenty of storage sitting on a NAS somewhere, or via Dropbox, Google Drive etc, which you can share with your colleagues. Why not just use that?

So that's what this adapter does. When enabled, all LFS uploads and downloads are simply translated into file copies to/from a folder that's visible to your system already. Put your media on a shared folder, or on a synced folder like Dropbox, or Synology Cloud Drive etc.

How to use

Prerequisites

You need to be running Git LFS version 2.3.0 or later. This has been tested with 2.5.2 and 2.6.0 (and with Git 2.19.1).

Download & install

You will need lfs-folderstore[.exe] to be on your system path somewhere.

Either download and extract the latest release, or build it from source using the standard go build.

Configure a fresh repo

Starting a new repository is the easiest case.

  • Initialise your repository as usual with git init and git lfs track *.png etc
  • Create some commits with LFS binaries
  • Add your plain git remote using git remote add origin <url>
  • Run these commands to configure your LFS folder:
    • git config --add lfs.customtransfer.lfs-folder.path lfs-folderstore
    • git config --add lfs.customtransfer.lfs-folder.args "C:/path/to/your/folder"
    • git config --add lfs.standalonetransferagent lfs-folder
  • git push origin master will now copy any media to that folder

A few things to note:

  • As shown, if on Windows, use forward slashes for path separators
  • If you have spaces in your path, add additional single quotes around the path
    • e.g. git config --add lfs.customtransfer.lfs-folder.args "'C:/path with spaces/folder'"
  • The standalonetransferagent forced Git LFS to use the folder agent for all pushes and pulls. If you want to use another remote which uses the standard LFS API, you should see the next section.

Configure an existing repo

If you already have a Git LFS repository pushing to a standard LFS server, and you want to either move to a folder, or replicate, it's a little more complicated.

  • Create a new remote using git remote add folderremote <url>. Do this even if you want to keep the git repo at the same URL as currently.
  • Run these commands to configure the folder store:
    • git config --add lfs.customtransfer.lfs-folder.path lfs-folderstore
    • git config --add lfs.customtransfer.lfs-folder.args "C:/path/to/your/folder"
    • git config --add lfs.<url>.standalonetransferagent lfs-folder - important: use the new Git repo URL
  • git push folderremote master ... - important: list all branches you wish to keep LFS content for. Only LFS content which is reachable from the branches you list (at any version) will be copied to the remote

Cloning a repo

There is one downside to this 'simple' approach to LFS storage - on cloning a repository, git-lfs can't know how to fetch the LFS content, until you configure things again using git config. That's the nature of the fact that you're using a simple Git remote with no LFS API to expose this information.

It's not that hard to resolve though, you just need a couple of extra steps when you clone fresh. Here's the sequence:

  • git clone <url> <folder>
    • this will work for the git data, but will report "Error downloading object" when trying to get LFS data
  • cd <folder> - to enter your newly cloned repo
  • Configure as with a new repo:
    • git config --add lfs.customtransfer.lfs-folder.path lfs-folderstore
    • git config --add lfs.customtransfer.lfs-folder.args "C:/path/to/your/folder"
    • git config --add lfs.standalonetransferagent lfs-folder
  • git reset --hard master
    • This will sort out the LFS files in your checkout and copy the content from the now-configured shared folder

Notes

  • The shared folder is, to git, still a "remote" and so separate from clones. It only interacts with it during fetch, pull and push.
  • Copies are used in all cases, even if you're using Dropbox, Google Drive etc as your folder store. While hard links are possible and would save space, for integrity reasons (no copy-on-write) I've kept things simple.
  • It's entirely up to you whether you use different folder paths per project, or share one between many projects. In the former case, it's easier to reclaim space by deleting a specific project, in the latter case you can save space if you have common files between projects (they'll have the same hash)

License (MIT)

Copyright Β© 2018 Steve Streeting

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

More Repositories

1

SPUD

Steve's Persistent Unreal Data library
C++
281
star
2

UnityRecyclingListView

A fast scrolling list component for Unity UI which recycles its child elements
C#
173
star
3

UnityInstancedHealthBars

Example projects using instancing in Unity to render enemy health bars in 1 draw call
C#
146
star
4

StevesUEHelpers

A plugin adding a bunch of common helper functionality that I use in my UE projects
C++
140
star
5

UnityCsvUtil

Lightweight but type safe CSV serialise/deserialise of objects
C#
136
star
6

UEScripts

Helper scripts for Unreal Engine
PowerShell
120
star
7

UnityMultiBuild

Batch build for multiple platforms from within the Unity editor
C#
103
star
8

SUQS

Steve's Unreal Quest System: data-driven quest system for Unreal Engine
C++
100
star
9

SUDS

Steve's Unreal Dialogue System
C++
69
star
10

UnitySpline2D

2D spline utility for Unity
C#
68
star
11

UnityToonPBS

Adaptation of the standard Unity PBS shader to include Toon lighting
ShaderLab
28
star
12

spriterecolour

Sprite processor to allow dynamic recolouring
Go
26
star
13

SpriteRecolourUnity

Demo project for spriterecolour in Unity
C#
22
star
14

UnityBuildReleasePS

Set of useful Powershell scripts for batch building games made in Unity and releasing them to Itch & Steam
PowerShell
20
star
15

GitScripts

A series of useful Git scripts that I use
PowerShell
17
star
16

SUSS

Steve's UtilityAI SubSystem (for Unreal Engine 5)
C++
15
star
17

SPUDExamples

An example project for SPUD
C++
13
star
18

StevesUEExamples

Example project that demonstrates the use of StevesUEHelpers
C#
10
star
19

git-lfs-ssh-serve

Experimental reference implementation of pure SSH server for Git-LFS
Go
8
star
20

FbxUdimUnpack

Tool for unpacking a model that uses UDIMs into a form more suitable for real-time use (separate materials per texture tile)
C++
7
star
21

SSSelectableToolbar

A preference-pane style selectable toolbar which switches views easily, allowing different sizes per pane, and not requiring a lot of manual code.
Objective-C
6
star
22

StevesUnrealUtils

Miscellaneous Unreal utilities
C++
6
star
23

SUDSExample

Example project for SUDS (Steve's Unreal Dialogue System)
C#
5
star
24

recipes

Just some recipes (real ones, as in baking / cooking)
5
star
25

UnityMarchingSquares

C#
5
star
26

SJSWolf

An old codebase from 1995 implementing a Wolfenstein engine
C++
4
star
27

PhotosExport

Export content from Photos.app to a directory
Objective-C
3
star
28

SUDSProExample

C++
3
star
29

suds-code

VSCode plugin for SUDS
Batchfile
3
star
30

cocoa2dotnet_translationconversion

Convert Cocoa .strings localisation files to .Net resource files
Python
2
star
31

s3putsecurefolder

Syncs the contents of a folder to Amazon S3, optionally encrypting the files with GPG beforehand.
Python
1
star