{"id":20134378,"url":"https://github.com/wearerequired/git-mirror-action","last_synced_at":"2025-04-04T14:06:15.033Z","repository":{"id":43367369,"uuid":"211041873","full_name":"wearerequired/git-mirror-action","owner":"wearerequired","description":"⏭ A GitHub Action for mirroring a git repository to another location via SSH.","archived":false,"fork":false,"pushed_at":"2022-03-05T10:05:02.000Z","size":21,"stargazers_count":143,"open_issues_count":4,"forks_count":62,"subscribers_count":4,"default_branch":"master","last_synced_at":"2024-10-24T16:16:27.646Z","etag":null,"topics":["github-action","ssh","workflow"],"latest_commit_sha":null,"homepage":"","language":"Shell","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/wearerequired.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-09-26T08:42:07.000Z","updated_at":"2024-09-03T06:37:45.000Z","dependencies_parsed_at":"2023-01-04T18:32:34.888Z","dependency_job_id":null,"html_url":"https://github.com/wearerequired/git-mirror-action","commit_stats":{"total_commits":21,"total_committers":6,"mean_commits":3.5,"dds":"0.38095238095238093","last_synced_commit":"c44c68aebe42de49a80a8dfd557416b6a0cafdad"},"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wearerequired%2Fgit-mirror-action","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wearerequired%2Fgit-mirror-action/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wearerequired%2Fgit-mirror-action/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wearerequired%2Fgit-mirror-action/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/wearerequired","download_url":"https://codeload.github.com/wearerequired/git-mirror-action/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247153236,"owners_count":20892620,"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":["github-action","ssh","workflow"],"created_at":"2024-11-13T21:09:22.291Z","updated_at":"2025-04-04T14:06:15.011Z","avatar_url":"https://github.com/wearerequired.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Git Mirror Action\n\nA GitHub Action for [mirroring a git repository](https://help.github.com/en/articles/duplicating-a-repository#mirroring-a-repository-in-another-location) to another location via SSH.\n\n## Inputs\n\n### `source-repo`\n\n**Required** SSH URL of the source repo.\n\n### `destination-repo`\n\n**Required** SSH URL of the destination repo.\n\n### `dry-run`\n\n**Optional** *(default: `false`)* Execute a dry run. All steps are executed, but no updates are pushed to the destination repo.\n\n## Environment variables\n\n`SSH_PRIVATE_KEY`: Create a [SSH key](https://docs.github.com/en/github/authenticating-to-github/connecting-to-github-with-ssh/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent#generating-a-new-ssh-key) **without** a passphrase which has access to both repositories. On GitHub you can add the public key as [a deploy key to the repository](https://docs.github.com/en/developers/overview/managing-deploy-keys#deploy-keys). GitLab has also [deploy keys with write access](https://docs.gitlab.com/ee/user/project/deploy_keys/) and for any other services you may have to add the public key to your personal account.  \nStore the private key as [an encrypted secret](https://docs.github.com/en/actions/reference/encrypted-secrets) and use it in your workflow as seen in the example workflow below.\n\n`SSH_KNOWN_HOSTS`: Known hosts as used in the `known_hosts` file. *StrictHostKeyChecking* is disabled in case the variable isn't available.\n\nIf you added the private key or known hosts in an [environment](https://docs.github.com/en/actions/reference/environments) make sure to [reference the environment name in your workflow](https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#jobsjob_idenvironment) otherwise the secret is not passed to the workflow.\n\n## Example workflow\n\n```yml\nname: Mirror to Bitbucket Repo\n\non: [ push, delete, create ]\n\n# Ensures that only one mirror task will run at a time.\nconcurrency:\n  group: git-mirror\n\njobs:\n  git-mirror:\n    runs-on: ubuntu-latest\n    steps:\n      - uses: wearerequired/git-mirror-action@v1\n        env:\n          SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }}\n          SSH_KNOWN_HOSTS: ${{ secrets.SSH_KNOWN_HOSTS }}\n        with:\n          source-repo: \"git@github.com:wearerequired/git-mirror-action.git\"\n          destination-repo: \"git@bitbucket.org:wearerequired/git-mirror-action.git\"\n```\n\n## Docker\n\n```sh\ndocker run --rm -e \"SSH_PRIVATE_KEY=$(cat ~/.ssh/id_rsa)\" $(docker build -q .) \"$SOURCE_REPO\" \"$DESTINATION_REPO\"\n```\n\n\n## License\n\nThe Dockerfile and associated scripts and documentation in this project are released under the [MIT License](LICENSE).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwearerequired%2Fgit-mirror-action","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwearerequired%2Fgit-mirror-action","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwearerequired%2Fgit-mirror-action/lists"}