Important Bits

Host your own Git LFS with node-lfs-s3

February 08, 2017

Want to use Git LFS without a Git-as-a-Service provider like GitHub or BitBucket?

Stuff you will need

  • AWS S3 to store files at a low cost
  • node-lfs-s3 to communicate between Git and S3. This can run on your own machine or in the cloud.
  • Git LFS installed in your development environment or a server you control and available in the system’s PATH. I’m using git-lfs/1.4.4 (GitHub; darwin amd64; go 1.7.3; git cbf91a9) with git version 2.5.4 (Apple Git-61) on OS X, and something else on Windows 10.
  • GitHub for Windows comes with its own Git LFS executable which may override the version you install on your own.

Things to configure

Your Git repository needs a file called .lfsconfig which points it at the Git LFS server. Here’s an example:

    url = "http://host:port/github-account-name/repo.git"
    batch = true
    access = basic
    sslverify = true

Commands you will run

Start up node-lfs-s3 with a command like this:

FS_BASE_URL=http://host:port/ LFS_PORT=port LFS_STORE_TYPE=s3 LFS_AUTHENTICATOR_TYPE=none LFS_JWT_SECRET=a_secret AWS_ACCESS_KEY=aws_access_key AWS_SECRET_KEY=aws_secret_key LFS_STORE_S3_BUCKET=bucket_name LFS_S3_REGION=us-east-1 node git-lfs-server.js

Adam Sullovey

Written by Adam Sullovey, powered by Gatsby.
Find me on codepen, github, or at Toronto meetups.