Code Monkey home page Code Monkey logo

git-sync's Introduction

git-sync

git-sync is a command that periodically syncs a remote git repository to a local directory.

This Python implementation is inspired by the Kubernetes module found here: https://github.com/kubernetes/contrib/tree/master/git-sync

Usage

Python

Install/setup

pip install click
git clone https://github.com/jlowin/git-sync.git
cd git-sync && chmod +x git-sync.py

To see available arguments:

./git-sync.py --help

Pass arguments at the command line:

./git-sync.py repo.git --dest /dest/path --branch branch --wait 30

or with environment variables:

GIT_SYNC_REPO=repo.git GIT_SYNC_DEST=/dest/path ./git-sync.py

Docker

By default, the docker container syncs to an internal directory /git.

docker run -v /vol jlowin/git-sync repo.git --dest /vol --wait 100

(This is a spectacularly useless example; you probably want to connect another container to the synced volume.)

Kubernetes

git-sync was originally designed as a side-car module that keeps a (shared) container volume in sync with a remote git repository.

For example, in a replication controller definition:

# this volume holds the synced repo
volumes:
- name: git-sync-volume
  emptyDir: {}

# this container syncs the repo every 1000 seconds
containers:
- name: git-sync
  image: jlowin/git-sync
  volumeMounts:
  - name: git-sync-volume
    mountPath: /git
  env:
  - name: GIT_SYNC_REPO
    value: <repo>
  - name: GIT_SYNC_DEST
    value: /git
  - name: GIT_SYNC_WAIT
    value: "1000"

# this container can access the synced data in /synced
- name: my-container
  volumeMounts:
  - name: git-sync-volume
    mountPath: /synced

git-sync's People

Contributors

jlowin avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.