{"id":16521582,"url":"https://github.com/agherzan/git-mirror-me","last_synced_at":"2025-10-28T07:31:49.176Z","repository":{"id":40233843,"uuid":"485356113","full_name":"agherzan/git-mirror-me","owner":"agherzan","description":"CLI tool that facilitates mirroring a source to a destination git repository","archived":false,"fork":false,"pushed_at":"2022-07-26T22:50:39.000Z","size":76,"stargazers_count":12,"open_issues_count":0,"forks_count":3,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-02-01T12:51:11.496Z","etag":null,"topics":["cli","git","mirror"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/agherzan.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":"FUNDING.yml","license":"COPYING.MIT","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null},"funding":{"github":["agherzan"]}},"created_at":"2022-04-25T12:09:42.000Z","updated_at":"2024-10-13T11:18:25.000Z","dependencies_parsed_at":"2022-08-24T19:30:18.032Z","dependency_job_id":null,"html_url":"https://github.com/agherzan/git-mirror-me","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/agherzan%2Fgit-mirror-me","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/agherzan%2Fgit-mirror-me/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/agherzan%2Fgit-mirror-me/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/agherzan%2Fgit-mirror-me/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/agherzan","download_url":"https://codeload.github.com/agherzan/git-mirror-me/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":238614645,"owners_count":19501497,"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":["cli","git","mirror"],"created_at":"2024-10-11T16:57:02.019Z","updated_at":"2025-10-28T07:31:43.907Z","avatar_url":"https://github.com/agherzan.png","language":"Go","funding_links":["https://github.com/sponsors/agherzan"],"categories":[],"sub_categories":[],"readme":"\u003c!--\nSPDX-FileCopyrightText: Andrei Gherzan \u003candrei@gherzan.com\u003e\n\nSPDX-License-Identifier: MIT\n--\u003e\n\n# Git Mirror-Me (`GMm`)\n\n[![Go Report Card](https://goreportcard.com/badge/github.com/agherzan/git-mirror-me)](https://goreportcard.com/report/github.com/agherzan/git-mirror-me)\n[![codecov](https://codecov.io/gh/agherzan/git-mirror-me/branch/main/graph/badge.svg?token=O54JVY4W31)](https://codecov.io/gh/agherzan/git-mirror-me)\n[![License](https://img.shields.io/github/license/agherzan/git-mirror-me?label=License)](/COPYING.MIT)\n[![REUSE status](https://api.reuse.software/badge/github.com/agherzan/git-mirror-me)](https://api.reuse.software/info/github.com/agherzan/git-mirror-me)\n\nThis CLI tool provides the ability to mirror a repository to any other git\nrepository with optional SSH authentication. For example, it can be used with\nrepositories on GitHub, GitLab, Bitbucket, etc.\n\nWhy \"Me\"? The name derives from the tool's \"ability\" to default the source\nrepository to the value computed from a GitHub action environment.\n\n## Install\n\n```\ngo install github.com/agherzan/git-mirror-me/cmd/git-mirror-me@latest\n```\n\n## Build\n\nUse the provided `make` script by taking advantage of the `build` target:\n\n```\nmake build\n```\n\n## Tool configuration\n\nThe tool can be configured via CLI arguments and/or environment variables.\nRun the tool in `help` mode (`git-mirror-me -h`) to check its full description.\n\n### Arguments/Flags\n\n#### `-source-repository`\n\n* Sets the source repository for the mirror operation.\n* Can also be set via environment variables.\n\n#### `-destination-repository`\n\n* Sets the destination repository for the mirror operation.\n* Can also be set via environment variables.\n\n#### `-ssh-known-hosts-path`\n\n* Defines the path to the `known_hosts` file.\n* This is an alternative to providing the host public keys via the\n  `GMM_SSH_KNOWN_HOSTS` environment variable (see below).\n\n#### `-debug`\n\n* Runs the tool in debug mode.\n* Can also be enabled via an environment variable.\n\n### Environment variables\n\nThis tool uses `GMM_` as prefix for all the environment variables defined in\nits scope. That doesn't include the ones prefixed by `GITHUB_` as they are\nexpected to be provided directly by the GitHub CI environment.\n\n#### `GMM_SRC_REPO`, `GITHUB_SERVER_URL` and `GITHUB_REPOSITORY`\n\n* The source repository can be provided in three ways, listed below in the\ndescending order of their precedence:\n  * the `-source-repository` CLI argument\n  * the `GMM_SRC_REPO` environment variable\n  * using the `GITHUB_SERVER_URL` and `GITHUB_REPOSITORY` environment variables\n    as `GITHUB_SERVER_URL/GITHUB_REPOSITORY`\n\n#### `GMM_DST_REPO`\n\n* Sets the destination repository for the mirror operation.\n\n#### `GMM_SSH_PRIVATE_KEY`\n\n* The SSH private key used for SSH authentication during git push operation.\n* Password protected SSH keys are not supported.\n* When not defined, `git` operations will be executed without authentication.\n* When defined, a host public key configuration is required.\n\n#### `GMM_SSH_KNOWN_HOSTS`\n\n* The hosts public keys used for host validation.\n* The format needs to be based on the`known_hosts` file.\n\n#### `GMM_DEBUG`\n\n* When set to '1', runs the tools in debug mode.\n\n## Tests and Linters\n\nUse the provided `make` script. For tests, a `test` target is provided: `make\ntest`.\n\nLinters can be executed using `make lint`. This make target has additional host\ndependencies on\n[golangci-lint](https://github.com/golangci/golangci-lint).\n\n## Contributing\n\nContributions are more than welcome. You can send patches using [GitHub pull\nrequests](https://github.com/agherzan/git-mirror-me/pulls).\n\n### Developer Certificate of Origin\n\nThe Developer Certificate of Origin (DCO) is a lightweight way for contributors\nto certify that they wrote or otherwise have the right to submit the code they\nare contributing to the project. Here is the full [text of the\nDCO](https://developercertificate.org/), reformatted for readability:\n\n\u003e By making a contribution to this project, I certify that:\n\u003e\n\u003e a. The contribution was created in whole or in part by me and I have the\n\u003e right to submit it under the open source license indicated in the file; or\n\u003e\n\u003e b. The contribution is based upon previous work that, to the best of my\n\u003e knowledge, is covered under an appropriate open source license and I have the\n\u003e right under that license to submit that work with modifications, whether\n\u003e created in whole or in part by me, under the same open source license (unless\n\u003e I am permitted to submit under a different license), as indicated in the\n\u003e file; or\n\u003e\n\u003e c. The contribution was provided directly to me by some other person who\n\u003e certified (a), (b) or (c) and I have not modified it.\n\u003e\n\u003e d. I understand and agree that this project and the contribution are public\n\u003e and that a record of the contribution (including all personal information I\n\u003e submit with it, including my sign-off) is maintained indefinitely and may be\n\u003e redistributed consistent with this project or the open source license(s)\n\u003e involved.\n\nContributors _sign-off_ that they adhere to these requirements by adding a\n`Signed-off-by` line to commit messages.\n\n```\nThis is my commit message\n\nSigned-off-by: Random J Developer \u003crandom@developer.example.org\u003e\n```\n\nGit has a `-s` command line option to append this automatically to your\ncommit message based on your git configuration (name and email):\n\n```\n$ git commit -s -m 'This is my commit message'\n```\n\n## Maintainers\n\n* Andrei Gherzan `\u003candrei at gherzan.com\u003e`\n\n## LICENSE\n\nThis repository is [reuse](https://reuse.software/) compliant and it is\nreleased under the [MIT](COPYING.MIT) license.\n\nFor convenience, a `make` target is provided to validate this compliance: `make\nreuse`. This `make` target has an additional but optional host dependency\non [reuse](https://github.com/fsfe/reuse-tool).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fagherzan%2Fgit-mirror-me","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fagherzan%2Fgit-mirror-me","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fagherzan%2Fgit-mirror-me/lists"}