Skip to main content

Simple Python server to serve a read only HTTP mirror of git repositories that use Large File Storage (LFS)

Project description

git-lfs-http-mirror

Python wrapper for git that allows it to read a GET-only HTTP mirror of repositories that use Large File Storage (LFS). It effectively extends git's so-called dumb git protocol with the capability to serve LFS files.

This means you can use S3 to host mirrors of LFS repositories, without additional infrastructure. However, no authentication mechanism is currently supported. From the point of view of the calling code, it must be a publically readable bucket.

It works by temporarily firing up an LFS server during the lifetime of the git command.

Installation

pip install git-lfs-http-mirror

Usage

Configuration is by command line arguments

python -m git_lfs_http_mirror
    --upstream-root 'https://my-bucket.s3.eu-west-2.amazonaws.com/a-folder'
    --bind '127.0.0.1:8080'
    -- git clone http://127.0.0.1:8080/my-repo

You can make this slightly less verbose my making a wrapper bash script. If the below is in an executable file glfsm in your PATH

#!/usr/bin/env bash

exec python -m git_lfs_http_mirror \
    --upstream-root 'https://my-bucket.s3.eu-west-2.amazonaws.com/a-folder' \
    --bind '127.0.0.1:8080' \
    $@

then you can call

glfsm -- git clone http://127.0.0.1:8080/my-repo

The server configued as upstream_root should be a static server, serving copies of git repositories, for example S3. Each copy can be created using:

git clone --bare https://server.test/my-repo
cd my-repo.git
git lfs fetch
git update-server-info

and then uploaded to the server in its own folder. If the server is S3, this can be done using the Upload folder feature in the AWS S3 Console.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

git_lfs_http_mirror-0.0.7.tar.gz (4.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

git_lfs_http_mirror-0.0.7-py3-none-any.whl (4.6 kB view details)

Uploaded Python 3

File details

Details for the file git_lfs_http_mirror-0.0.7.tar.gz.

File metadata

  • Download URL: git_lfs_http_mirror-0.0.7.tar.gz
  • Upload date:
  • Size: 4.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/4.0.2 CPython/3.11.8

File hashes

Hashes for git_lfs_http_mirror-0.0.7.tar.gz
Algorithm Hash digest
SHA256 b1cc5841f679f2732b22e331b5fc9fe1635185e63ccb0507aab23c6ba0bfde79
MD5 5ac82f915feb5b2fbba1f6e88dc1c88f
BLAKE2b-256 5a582ad19c0b4f7851ce072f26f219bb76f0f02c93e67900f86c91dbfb29a934

See more details on using hashes here.

File details

Details for the file git_lfs_http_mirror-0.0.7-py3-none-any.whl.

File metadata

File hashes

Hashes for git_lfs_http_mirror-0.0.7-py3-none-any.whl
Algorithm Hash digest
SHA256 cbc603ddfbe5f9ff9615304ceddbdb78f866e1a96621b01562a3988a8647275c
MD5 931190b897d6efafeab3e2c8a18c3088
BLAKE2b-256 39a9ec133f8dfaebf5027d51118b23f5d119744376e30e1551af2df1d9749ae9

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page