A git layering tool

gilt is a Python command line tool to allow the overlaying / layering of multiple [[git]] repositories on top of each other. The tool is often used within [[Ansible]] to allow for a form of modules.

gilt uses a [[YAML]] based configuration file similar to below.

Installation

pip install python-gilt

Basic Usage

Overlay a remote repository into the destination provided.

gilt.yml

  - git: https://github.com/retr0h/ansible-etcd.git
    version: master
    dst: roles/retr0h.ansible-etcd/
gilt —debug overlay

Overlay files from a remote repository into the destinations provided.

gilt.yml

  - git: https://github.com/lorin/openstack-ansible-modules.git
    version: master
    files:
      - src: "*_manage"
        dst: library/
      - src: nova_quota
        dst: library/
      - src: neutron_router
        dst: library/neutron_router.py

Overlay a directory from a remote repository into the destination provided.

gilt.yml

  - git: https://github.com/blueboxgroup/ursula.git
    version: master
    files:
      - src: roles/logging
        dst: roles/blueboxgroup.logging/

How to save username & password in git

git config --global credential.helper store

When running this command, the first time you pull or push from the remote repository, you’ll get asked about the username and password.

Afterwards, for consequent communications with the remote repository you don’t have to provide the username and password.

The storage format is a .git-credentials file, stored in plaintext.

Also, you can use other helpers for the git config credential.helper, namely memory cache:

git config credential.helper cache <timeout>

which takes an optional timeout parameter, determining for how long the credentials will be kept in memory. Using the helper, the credentials will never touch the disk and will be erased after the specified timeout. The default value is 900 seconds (15 minutes).

readthedocs.io

gilt --debug overlay