Skip to content

laeti-tia/git-cache-http-server

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

A caching Git HTTP server

Mirror remote repositories and serve them over HTTP, automatically updating them as needed.

Currently supported client operations are fetch and clone. Authentication to the upstream repository is always enforced (for now, only HTTP Basic is supported), but public repositories can be used as well.

Usage

Usage:
  git-cache-http-server.js [options]

Options:
  -c,--cache-dir <path>   Location of the git cache [default: /var/cache/git]
  -p,--port <port>        Bind to port [default: 8080]
  -h,--help               Print this message
  --version               Print the current version

The upstream remote is extracted from the URL, taking the first component as the remote hostname.

Example:

git-cache-http-server --port 1234 --cache-dir /tmp/cache/git &
git clone http://localhost:1234/github.com/jonasmalacofilho/git-cache-http-server

If you run your git-cache on a dedicated server or container (i.e. named gitcache), you can then also configure git to always use your cache like in the following example (don't use this configuration on the git-cache machine itself):.

git config --global url."http://gitcache:1234/".insteadOf https://

Installing

Requirements: nodejs and git.

Install: npm install -g git-cache-http-server

To install as a service, check the doc/git-cache-http-server.service example service file.

For Systemd init users, this file should not require major tweaks other than specifying a different than default port number or cache directory. After installed in the proper Systemd unit path for your distribution, issue:

systemctl daemon-reload
systemctl start git-cache-http-server

Building from source

This is needed only if you change the Haxe source code in src/.

Requirements: haxe and hmm. If you prefer to manage the build dependencies manually, check out hmm.json for the required libraries.

hmm install
haxe build.hxml

Docker image

A Dockerfile is provided for you to build and run the git-cache-http-server application in a container. Debian is used inside this container.

To build the docker image, you just need to run the following:

docker build -t mylocal:git-cache .

Then, to run the image just built, you do:

docker run --name git-cache-1234 -d -p 1234:1234 mylocal:git-cache

Further runs need only to start the existing container so that the cache content is preserved (and will be updated).

Implementation

The current implementation is somewhat oversimplified; any help in improving it is greatly appreciated!

References:

About

A caching Git HTTP server

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Haxe 99.0%
  • JavaScript 1.0%