A simple Git LFS server implementation in Dart
Git Large File Storage (LFS) is a free, open-source extension that replaces large files with text pointers inside Git and stores the contents of those files on a remote server. — GitHub Training & Guides
Git LFS protocol requires a Git server that supports LFS, and a Git LFS client. There is only one official open-source LFS client. But there are several LFS server implementations. This implementation provides a simple solution that works with Git mirrors.
An example that this implementation can be used for
Your team has a (LFS) repo at GitHub (which supports LFS). That repo contains very large file(s) so you mirror it to your local machine to share with your team to save bandwidth. Your teammates can clone/fetch/pull from your local machine instead of GitHub. The problem is
git lfs always fails to fetch the file. You run
git lfs fetch --all on the mirror but it doesn’t solve the problem. That’s because your machine doesn’t have a Git LFS server. So this implementation now comes in handy. Just install, run it, then your teammates can clone/fetch/pull from your local machine, with LFS. Note that this implementation only supports download operations, i.e.
git lfs fetch. You cannot upload files, i.e.
git lfs push.
- Dart SDK:
git-lfs-serveris a Dart package so it needs this to execute.
sudo snap install flutter
brew install flutter
git-lfs-serverneeds this to generate a random authentication code.
sudo apt-get install pwgen
brew install pwgen
- Git LFS: you need to fetch large files from original remote manually.
sudo apt-get install git-lfs
brew install git-lfs
dart pub global activate --source git https://github.com/khoa-io/git-lfs-server.git
- Generate a key pair:
openssl req -x509 -sha256 -nodes -days 2100 -newkey rsa:2048 -keyout mine.key -out mine.crt
- Convert the key pair to a PEM file:
openssl x509 -in mine.crt -out mine.pem
- Generate a key pair:
- Client: modify
[http "https://address:port"] sslverify = false
git-lfs-server needs some environment variables in order to run:
GIT_LFS_SERVER_URL: The URL of the
git-lfs-server, for example:
GIT_LFS_EXPIRES_IN: The number of seconds after which the server will expire the file object, for example
GIT_LFS_SERVER_CERT: The path to the certificate file, for example
GIT_LFS_SERVER_KEY: The path to the key file, for example
GIT_LFS_AUTHENTICATE_TRACE: Controls logging of
GIT_LFS_SERVER_TRACE: Controls logging of
GIT_LFS_AUTH_SERVICE_TRACE: Controls logging of
GIT_LFS_HTTP_SERVER_TRACE: Controls logging of the
Check out DEVELOPING.md