# git-autopush

Script+container image that periodically mirrors a local repository to a remote location, e.g. keep a gitlab/github mirror up-to-date with a repo hosted on a private server

Example `docker run` command:  
`docker run --rm --env-file .env -v ./ssh:/ssh:ro -v ./git:/git:ro "$(docker build -q .)"`

`./ssh` should contain your key for pushing  
`./git` should contain the repositores you want to push

### .env parameters
* PUSH_KEY: file name of the private ssh key in the `ssh` directory to be used for pushing, e.g. `id_rsa`
* PUSH_DELAY: how long to sleep between pushes, should be a string compatible with sleep(1)
* PUSH_URLS: a `|` and `space` separated list of urls and directory names, e.g. `git@someserver:myrepo myrepo.git|git@someserver:myotherrepo myrepo2.git`
    * `git@someserver:myrepo` and `git@someserver:myotherrepo` are the urls passed to git as a push destination
    * `myrepo.git` and `myrepo2.git` are directory names relates to `/git` inside the container

### TODO
* allow custom refspecs to be added (for e.g. git-bug)
* port script to python and use json config instead of environment variables
