{"id":14235619,"url":"https://github.com/alarsyo/lohr","last_synced_at":"2025-04-06T22:06:41.447Z","repository":{"id":62442441,"uuid":"352474097","full_name":"alarsyo/lohr","owner":"alarsyo","description":"Git mirroring daemon","archived":false,"fork":false,"pushed_at":"2025-02-23T20:09:29.000Z","size":125,"stargazers_count":40,"open_issues_count":2,"forks_count":2,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-03-30T21:06:20.693Z","etag":null,"topics":["git","mirroring","rocket","rust"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/alarsyo.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE-APACHE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-03-29T00:47:59.000Z","updated_at":"2025-03-18T19:57:27.000Z","dependencies_parsed_at":"2024-09-16T12:42:27.076Z","dependency_job_id":null,"html_url":"https://github.com/alarsyo/lohr","commit_stats":{"total_commits":74,"total_committers":2,"mean_commits":37.0,"dds":"0.18918918918918914","last_synced_commit":"58503cc8b95c8b627f6ae7e56740609e91f323cd"},"previous_names":[],"tags_count":13,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alarsyo%2Flohr","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alarsyo%2Flohr/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alarsyo%2Flohr/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alarsyo%2Flohr/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/alarsyo","download_url":"https://codeload.github.com/alarsyo/lohr/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247557767,"owners_count":20958047,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["git","mirroring","rocket","rust"],"created_at":"2024-08-20T21:02:09.401Z","updated_at":"2025-04-06T22:06:41.429Z","avatar_url":"https://github.com/alarsyo.png","language":"Rust","funding_links":[],"categories":["Rust"],"sub_categories":[],"readme":"# lohr\n\n`lohr` is a Git mirroring tool.\n\nI created it to solve a simple problem I had: I host my own git server at\n\u003chttps://git.alarsyo.net\u003e, but want to mirror my public projects to GitHub /\nGitLab, for backup and visibility purposes.\n\nGitLab has a mirroring setting, but it doesn't allow for multiple mirrors, as\nfar as I know. I also wanted my instance to be the single source of truth.\n\n## How it works\n\nGitea is setup to send webhooks to my `lohr` server on every push update. When\n`lohr` receives a push, it clones the concerned repository, or updates it if\nalready cloned. Then it pushes the update to **all remotes listed** in the\n[.lohr](.lohr) file at the repo root.\n\n### Destructive\n\nThis is a very destructive process: anything removed from the single source of\ntruth is effectively removed from any mirror as well.\n\n## Installing\n\n`lohr` is [published on crates.io](https://crates.io/crates/lohr), so you can\ninstall it with `cargo install`:\n\n    $ cargo install lohr\n\nNote: currently this method won't get you the latest version of `lohr`, as it\ndepends on Rocket v0.5.0, which isn't released yet. Updated versions of `lohr`\nwill be published on crates.io as soon as Rocket v0.5.0 releases.\n\n## Setup\n\n### Quickstart\n\nSetting up `lohr` should be quite simple:\n\n1.  Create a `Rocket.toml` file and [add your\n    configuration](https://rocket.rs/v0.4/guide/configuration/).\n\n2.  Export a secret variable:\n    \n        $ export LOHR_SECRET=42 # please don't use this secret\n\n3.  Run `lohr`:\n    \n        $ cargo run # or `cargo run --release` for production usage\n\n4.  Configure your favorite git server to send a webhook to `lohr`'s address on\n    every push event.\n    \n    I used [Gitea's webhooks format](https://docs.gitea.io/en-us/webhooks/), but\n    I **think** they're similar to GitHub and GitLab's webhooks, so these should\n    work too! (If they don't, **please** file an issue!)\n    \n    Don't forget to set the webhook secret to the one you chose above.\n\n5.  Add a `.lohr` file containing the remotes you want to mirror this repo to:\n    \n        git@github.com:you/your_repo\n    \n    and push it. That's it! `lohr` is mirroring your repo now.\n\n\n### Configuration\n\n#### Home directory\n\n`lohr` needs a place to clone repos and store its data. By default, it's the\ncurrent directory, but you can set the `LOHR_HOME` environment variable to\ncustomize it.\n\n#### Shared secret\n\nAs shown in the quickstart guide, you **must** set the `LOHR_SECRET` environment\nvariable.\n\n#### Extra remote configuration\n\nYou can provide `lohr` with a YAML file containing additional configuration. You\ncan pass its path to the `--config` flag when launching `lohr`. If no\nconfiguration is provided via a CLI flag, `lohr` will check the `LOHR_CONFIG`\nenvironment variable. If the environment variable isn't set either, it will\ncheck in `LOHR_HOME` is a `lohr-config.yaml` file exists, and try to load it.\n\nThis file takes the following format:\n\n``` yaml\ndefault_remotes:\n    - \"git@github:user\"\n    - \"git@gitlab:user\"\n\nadditional_remotes:\n    - \"git@git.sr.ht:~user\"\n\nblacklist:\n    - \"private-.*\"\n```\n\n- `default_remotes` is a list of remotes to use if no `.lohr` file is found in a\n  repository.\n- `additional_remotes` is a list of remotes to add in any case, whether the\n  original set of remotes is set via `default_remotes` or via a `.lohr` file.\n- `blacklist` is a list of regular expressions to match against the full\n  repository names. Any that matches will not be mirrored, even if it contains a\n  `.lohr` file.\n\nBoth settings take as input a list of \"stems\", i.e. incomplete remote addresses,\nto which the repo's name will be appended (so for example, if my\n`default_remotes` contains `git@github.com:alarsyo`, and a push event webhook is\nreceived for repository `git@gitlab.com:some/long/path/repo_name`, then the\nmirror destination will be `git@github.com:alarsyo/repo_name`.\n\n## Contributing\n\nI accept patches anywhere! Feel free to [open a GitHub Pull\nRequest](https://github.com/alarsyo/lohr/pulls), [a GitLab Merge\nRequest](https://gitlab.com/alarsyo/lohr/-/merge_requests), or [send me a patch\nby email](https://lists.sr.ht/~alarsyo/lohr-dev)!\n\n## Why lohr?\n\nI was looking for a cool name, and thought about the Magic Mirror in Snow White.\nSome **[furious wikipedia\nsearching](https://en.wikipedia.org/wiki/Magic_Mirror_(Snow_White))** later, I\nfound that the Magic Mirror was probably inspired by [the Talking Mirror in Lohr\nam Main](http://spessartmuseum.de/seiten/schneewittchen_engl.html). That's it,\nthat's the story.\n\n## License\n\n`lohr` is distributed under the terms of both the MIT license and the Apache\nLicense (Version 2.0).\n\nSee [LICENSE-APACHE](LICENSE-APACHE) and [LICENSE-MIT](LICENSE-MIT) for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falarsyo%2Flohr","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Falarsyo%2Flohr","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falarsyo%2Flohr/lists"}