#repo #sync #mirror #git-sync

app git-sync

Simple tool to create and maintain a backup sync of your own repo

1 unstable release

new 0.0.1 Apr 22, 2025

#67 in #mirror

38 downloads per month

MIT license

8KB
139 lines

Docker Git Mirror

This repository hosts a Docker application designed to automate the mirroring of Git repositories. It's particularly useful for backing up repositories or ensuring that a synchronous copy of a repository is consistently available.

Features

  • Automated Mirroring: Set up once and have the application continuously mirror the repositories you specify.
  • Dockerized: Runs in a Docker container, ensuring platform independence and ease of deployment.
  • Simple Configuration: Utilizes a straightforward configuration file to set up source and target repositories.

Getting Started

Prerequisites

  • Docker installed on your system. For installation instructions, visit Docker's website.
  • A list of Git repositories you wish to mirror.

Installation

  1. Clone this repository:
    git clone https://github.com/devmaxde/docker-git-mirror.git
    
  2. Navigate to the project directory:
    cd docker-git-mirror
    

Usage

  1. Configure your repositories: Create a config.toml file inside the docker-config directory. A Example config can look like this:
timeout = 120

[[repos]]
ident = "my_project"
source_url = "git@github.com:devmaxde/docker-git-mirror.git"
target_url = "git@github.com:devmaxde/TestREPO.git"
  1. Set up SSH keys and known hosts: Place your SSH private key, public key, and known_hosts file in a config directory. Direct access is not recommended. You should also set the ssh-keys to read-only.

  2. Use Docker Compose to run the application: Update the docker-compose.yml file as follows and then start the service:

    services:
    mirror:
      build: .
      networks:
        - internet
      volumes:
        - "./docker-config/config.toml:/root/config.toml"
        - "./docker-config/github:/root/.ssh/id_rsa:ro"
        - "./docker-config/github.pub:/root/.ssh/id_rsa.pub:ro"
        - "./docker-config/known_hosts:/root/.ssh/known_hosts"
    networks:
      internet:
    

Run the Docker Compose command:

docker-compose up -d

Contributing

Contributions are welcome! Please fork the repository and submit pull requests with your proposed changes.

Dependencies

~1.8–2.6MB
~53K SLoC