Tiny Git repository mirror tool.
Go to file
2020-12-07 00:48:30 +01:00
src Support command-line args 2020-12-07 00:48:30 +01:00
.gitignore Init 2020-12-05 17:21:57 +01:00
Cargo.lock Support command-line args 2020-12-07 00:48:30 +01:00
Cargo.toml Support command-line args 2020-12-07 00:48:30 +01:00
README.md Update readme 2020-12-07 00:09:38 +01:00


Small standalone utility to help with Git repository mirroring, using a single JSON config file. If you read this on Github, I did not push it there myself, Mira did!


Mira automates mirroring a bunch of repository. Some people do not wish to use Github, Gitlab Cloud or Bitbucket as their primary repository for various reasons and run their own private Git servers, but making your code available on these platforms still has advantages (visibility, issues, PR, etc).

Mira is a quick fix to that, hopefully just copy an example below, put it in a Systemd service and be done with it.


Example configuration for the mirroring of this repository from a Gitea instance to its Github mirror:

    "workspace": "/tmp/mira",
    "configurations": [
            "name": "Gitea to Github",
            "mirrors": [
		    "name": "Mira",
		    "src": "ssh://git@gitea.example.com:12345/Dece/Mira.git",
		    "dest": "git@github.com:Dece/Mira.git"

The different values are:

  • workspace: a place where Mira can clone, fetch and push from.
  • configurations: a set of configurations using similar auth mechanisms. For now it is quite useless as no such mechanisms are supported.
  • configurations.N.name: name of a configuration, a directory in the workspace.
  • configurations.N.mirrors: list of mirrors.
  • mirrors.N.name: name of a mirror, used to determine the directory where to clone and work from.
  • mirrors.N.src: clone and fetch URL for the mirror, passed to git clone. Usually copying the URL provided by your server for cloning should suffice (HTTP or SSH).
  • mirrors.N.dest: push URL for the mirror, set as a remote named "mirror".

It may require some testing to determine what are the appropriate URLs for clone and push. Gitea with SSH uses the full "ssh://" syntax, whereas Github uses the simplified scp-like syntax. See the official clone help page for details.

When the configuration above is used, the output is the following:

$ ./mira -c config.json
Processing config Gitea to Github.
Mira mirrored successfully.

It does not support any authentication mechanisms beside what we'll be available at the shell, which means you should run it in an environment where an SSH agent will take care of authenticating yourself against the various servers you will be mirroring from and to.