Git clone wrapper with caching and fast reference clones
Project description
git-cache-clone
git-cache-clone is a drop-in wrapper for git clone that accelerates repository cloning by using a local cache. It's designed to optimize CI pipelines and repetitive local workflows by avoiding redundant network fetches.
Features
- Fast
git clonevia--reference - Subcommands for
clone,clean,refresh,add,info - Handles concurrent operations on cache entries via file locks
- Managed cache directory
- Safe and explicit cache cleanup
- URL normalization to avoid duplicate cache entries
Installation
pip3 install git-cache-clone
Usage
Various subcommands are available. When no subcommand is provided, clone is assumed.
git cache clone- Clone a repository using the cache; adds to cache if missinggit cache add- Add a repository to the cache manuallygit cache clean- Remove cached repositoriesgit cache refresh- Rungit fetchon cached repositoriesgit cache info- Show details on cache contents
By default,
Note on Argument Parsing
git-cache-clone accepts its own options and subcommands. To pass arguments directly to the underlying git command, you must use --. Everything after -- is forwarded verbatim.
✅ Correct usage:
git cache clone <url> -- --depth=1
git cache refresh <url> -- --unshallow
❌ Incorrect usage:
git cache clone --depth=1 <url>
git cache refresh --unshallow <url>
Configuration
Run git cache -h to see all available subcommands and their options.
Some widely used configurations can be set via environment variables and git config:
| Env Variable | Git Config Key | Type | Valid Values / Description | Default |
|---|---|---|---|---|
GIT_CACHE_ROOT_DIR |
gitcache.rootdir |
path |
working directory of git-cache-clone | ~/.local/share/git-cache |
GIT_CACHE_USE_LOCK |
gitcache.uselock |
bool |
true, 1, y, yes |
true |
GIT_CACHE_LOCK_TIMEOUT |
gitcache.locktimeout |
number |
timeout in seconds to wait for a lock | -1 |
GIT_CACHE_CLONE_MODE |
gitcache.clonemode |
string |
bare, mirror |
bare |
GIT_CACHE_METADATA_STORE_MODE |
gitcache.metadatastoremode |
string |
sqlite, json, none |
sqlite |
⚙️ Option Precedence
When resolving configuration values, git-cache-clone applies the following precedence, from highest to lowest:
-
Command-line arguments
-
Environment variables
-
Git configuration (git config)
-
Built-in defaults
Requirements
- Python 3.6+
- Git installed and available in PATH
License
MIT License
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file git_cache_clone-0.2.0.tar.gz.
File metadata
- Download URL: git_cache_clone-0.2.0.tar.gz
- Upload date:
- Size: 28.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.1.2 CPython/3.11.0rc1 Linux/5.15.167.4-microsoft-standard-WSL2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ebc16174b74c7d971941fbf8430848adad0ec571ba5101e03aefb87668c6e6eb
|
|
| MD5 |
48eff7491bc14054d4ce4a7b386d16dc
|
|
| BLAKE2b-256 |
f032d0d6f325ec71a127649dc292f52d4a4a501291affadd22b82bc9df004622
|
File details
Details for the file git_cache_clone-0.2.0-py3-none-any.whl.
File metadata
- Download URL: git_cache_clone-0.2.0-py3-none-any.whl
- Upload date:
- Size: 44.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.1.2 CPython/3.11.0rc1 Linux/5.15.167.4-microsoft-standard-WSL2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ff81d636b75094016f7e69db1b05d9ba966298f84692d121975df2acdb9eddf8
|
|
| MD5 |
4ffa3cb9652e55c2a214d6b01da42c21
|
|
| BLAKE2b-256 |
a6de3d5f69428a0526bf67f31fdb8d3883f518f7c721bc08d899e3f544786563
|