Node Git LFS
A NodeJS implementation of Git LFS Server.
Installation
npm install node-git-lfs
Features
- Support Git LFS v1 Batch API
- Support SSH Authentication
- Multiple store supported - currently
AWS S3
,Azure Storage
,MongoDB GridFS
,file system
- Multiple authentication method support - currently
basic
andnone
- Use JWT to secure
download
,upload
andverify
endpoints - Option to directly upload to and download from AWS S3
- Use SHA256 checksum when upload directly to AWS S3
Configuration
All configurations can be done via environment variable or configuration file
Environment Variables
LFS_BASE_URL
- URL of the LFS server - requiredLFS_PORT
- HTTP portal of the LFS server, defaults to3000
- requiredLFS_OVERLAY
- Bool use Github's /info/lfs style url, defaults tofalse
- requiredLFS_STORE_TYPE
- Object store type, can be eithers3
(for AWS S3),s3_direct
(for direct upload and download from AWS S3) orgrid
(for MongoDB GridFS), defaults tos3
- requiredLFS_AUTHENTICATOR_TYPE
- Authenticator type, can bebasic
(for basic username and password),none
(for no authentication), defaults tonone
- requiredLFS_JWT_ALGORITHM
- JWT signature algorithm, defaults toHS256
LFS_JWT_SECRET
- JWT signature secret - requiredLFS_JWT_ISSUER
- Issuer of the JWT token, defaults tonode-git-lfs
LFS_JWT_EXPIRES
- JWT token expire time, defaults to30m
If storage type is s3
or s3_direct
:
AWS_ACCESS_KEY
- AWS access key - requiredAWS_SECRET_KEY
- AWS secret key - requiredLFS_STORE_S3_BUCKET
- AWS S3 bucket - requiredLFS_STORE_S3_ENDPOINT
- AWS S3 endpoint, normally this will be set by regionLFS_STORE_S3_REGION
- AWS S3 regionLFS_STORE_S3_STORAGE_CLASS
- AWS S3 storage class, can beSTANDARD
,STANDARD_IA
orREDUCED_REDUNDANCY
, defaults toSTANDARD
LFS_STORE_S3_SIGNATURE_VERSION
- AWS S3 signature version, if none given, v2 will be used. If your region is Frankfurt, you'll have to pass "v4" as version
If storage type is azure
:
AZURE_STORAGE_ACCOUNT
- Azure storage account - requiredAZURE_STORAGE_ACCESS_KEY
- Azure access key - requiredAZURE_STORAGE_CONNECTION_STRING
- Azure connection string - requiredAZURE_STORAGE_CONTAINER
- Azure container name
If storage type is grid
:
LFS_STORE_GRID_CONNECTION
- MongoDB connection URL - required
If storage type is local
:
LFS_STORE_LOCAL_PATH
- Path to storage location - required
If authenticator type is basic
:
LFS_AUTHENTICATOR_USERNAME
- Username - requiredLFS_AUTHENTICATOR_PASSWORD
- Password - requiredLFS_AUTHENTICATOR_CLIENT_PUBLIC_KEY
- Location of the client's public key (this option is stronger than setting the path)LFS_AUTHENTICATOR_CLIENT_PUBLIC_KEY_PATH
- Location of the client's public key folder (e.g. './ssh/public/')
SSH Environment Variables
LFS_SSH_ENABLED
- Enable SSH server, defaults totrue
LFS_SSH_PORT
- SSH server port, defaults to2222
LFS_SSH_IP
- SSH server bind IP, defaults to0.0.0.0
LFS_SSH_PUBLIC_KEY
- SSH server public key - required if SSH is enabledLFS_SSH_PRIVATE_KEY
- SSH server private key - required if SSH is enabled
Usage
These are some sample files to show how it could look on your machines
.gitattributes
*.psd filter=lfs diff=lfs merge=lfs -text
*.svg filter=lfs diff=lfs merge=lfs -text
.gitconfig
[core]
repositoryformatversion = 0
filemode = true
bare = false
logallrefupdates = true
ignorecase = true
precomposeunicode = true
[lfs]
url = "ssh://git@myserver.local:2222/user/repository"
batch = true
[remote "origin"]
url = git@github.org:user/repository.git
fetch = +refs/heads/*:refs/remotes/origin/*
remote = origin
merge = refs/heads/master
lfsurl = "ssh://git@myserver.local:2222/user/repository"
copy the public key to clipboard
cat ~/.ssh/id_rsa.pub | pbcopy
License
This Software is released under the Apache License