Skip to main content

A git clone wrapper that automatically uses --reference to save time and space.

Project description

License: GPL-3

A git clone wrapper that automatically uses –reference to save disk space and download time.


To install git-autoshare in a fancy way, we recommend using pipsi.

Pipsi is a powerful tool which allows you to install Python scripts into isolated virtual environments.

To install pipsi, first run this:

$ curl | python

Follow the instructions, you’ll have to update your PATH.

Then simply run:

$ pipsi install git-autoshare

To upgrade git-autoshare at any time:

$ pipsi upgrade git-autoshare

If you want git autoshare-clone to be invoked transparently in place of git clone, create the following bash script, name id git, and place it in your PATH before /usr/bin/git:

if [ "$1" == "clone" ]
    /usr/bin/git autoshare-clone "$@"
    /usr/bin/git "$@"


Configuration file

To configure it, create a file named git-autoshare/repos.yml in your user configuration directory (often ~/.config on Linux). This file must have the following structre:

        - organization
        - ...

It lists all git hosts, repositories, and organizations that are subject to the sharing of git objects. Here is an example:
        - odoo
        - OCA
        - OCA
        - acsone

git autoshare-clone command

If configured like the example above, when you git clone the odoo or mis-builder repositories from one of these github organizations, git autoshare-clone will automatically insert the --reference option in the git clone command. For example:

$ git autoshare-clone

will be transformed into:

$ /usr/bin/git clone --reference ~/.cache/git-autoshare/

git autoshare-prefetch command

The autoshare-prefetch command is mostly meant to be run in a cron job:

$ git autoshare-prefetch --quiet

will update the cache directory by fetching all repositories mentioned in repos.yml.

It can also prefetch one single repository, for example:

$ git autoshare-prefetch

Environment variables

The cache directory is named git-autoshare where appdirs.user_cache_dir is. This location can be configured with the GIT_AUTOSHARE_CACHE_DIR environment variable.

The default configuration file is named repos.yml where appdirs.user_config_dir is. This location can be configured with the GIT_AUTOSHARE_CONFIG_DIR environment variable.

By default git-autoshare invokes git as /usr/bin/git. This can be configured with the GIT_AUTOSHARE_GIT_BIN environment variable.





This project is maintained by ACSONE SA/NV.


1.0.0a1 (2017-10-10)

  • first packaged version

Project details

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page