{"id":14985958,"url":"https://github.com/wei/git-sync","last_synced_at":"2025-04-12T18:46:08.982Z","repository":{"id":47729541,"uuid":"194893761","full_name":"wei/git-sync","owner":"wei","description":"🔃 A GitHub Action for syncing between two independent repositories using force push","archived":false,"fork":false,"pushed_at":"2022-10-02T09:08:44.000Z","size":23,"stargazers_count":254,"open_issues_count":6,"forks_count":124,"subscribers_count":10,"default_branch":"master","last_synced_at":"2024-10-29T17:23:47.986Z","etag":null,"topics":["action","fork","github-action","hacktoberfest","sync"],"latest_commit_sha":null,"homepage":"","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/wei.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-07-02T15:53:00.000Z","updated_at":"2024-10-20T03:49:31.000Z","dependencies_parsed_at":"2023-01-11T17:23:03.353Z","dependency_job_id":null,"html_url":"https://github.com/wei/git-sync","commit_stats":{"total_commits":18,"total_committers":5,"mean_commits":3.6,"dds":"0.38888888888888884","last_synced_commit":"b52500964790ec9c1fd2f19c71c33ef3fe9c3bf8"},"previous_names":[],"tags_count":13,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wei%2Fgit-sync","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wei%2Fgit-sync/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wei%2Fgit-sync/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wei%2Fgit-sync/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/wei","download_url":"https://codeload.github.com/wei/git-sync/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248617502,"owners_count":21134191,"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":["action","fork","github-action","hacktoberfest","sync"],"created_at":"2024-09-24T14:12:01.818Z","updated_at":"2025-04-12T18:46:08.961Z","avatar_url":"https://github.com/wei.png","language":"Shell","readme":"# Git Sync\n\nA GitHub Action for syncing between two independent repositories using **force push**.\n\n## Features\n\n- Sync branches between two GitHub repositories\n- Sync branches to/from a remote repository\n- GitHub action can be triggered on a timer or on push\n- To sync with current repository, please checkout [Github Repo Sync](https://github.com/marketplace/actions/github-repo-sync)\n\n## Usage\n\n\u003e Always make a full backup of your repo (`git clone --mirror`) before using this action.\n\n### GitHub Actions\n\n```yml\n# .github/workflows/git-sync.yml\n\non: push\njobs:\n  git-sync:\n    runs-on: ubuntu-latest\n    steps:\n      - name: git-sync\n        uses: wei/git-sync@v3\n        with:\n          source_repo: \"source_org/repository\"\n          source_branch: \"main\"\n          destination_repo: \"destination_org/repository\"\n          destination_branch: \"main\"\n          ssh_private_key: ${{ secrets.SSH_PRIVATE_KEY }} # optional\n          source_ssh_private_key: ${{ secrets.SOURCE_SSH_PRIVATE_KEY }} # optional, will override `SSH_PRIVATE_KEY`\n          destination_ssh_private_key: ${{ secrets.DESTINATION_SSH_PRIVATE_KEY }} # optional, will override `SSH_PRIVATE_KEY`\n```\n\n##### Using shorthand\n\nYou can use GitHub repo shorthand like `username/repository`.\n\n##### Using ssh\n\n\u003e The `ssh_private_key`, or `source_ssh_private_key` and `destination_ssh_private_key` must be supplied if using ssh clone urls.\n\n```yml\nsource_repo: \"git@github.com:username/repository.git\"\n```\nor\n```yml\nsource_repo: \"git@gitlab.com:username/repository.git\"\n```\n\n##### Using https\n\n\u003e The `ssh_private_key`, `source_ssh_private_key` and `destination_ssh_private_key` can be omitted if using authenticated https urls.\n\n```yml\nsource_repo: \"https://username:personal_access_token@github.com/username/repository.git\"\n```\n\n#### Set up deploy keys\n\n\u003e You only need to set up deploy keys if repository is private and ssh clone url is used.\n\n- Either generate different ssh keys for both source and destination repositories or use the same one for both, leave passphrase empty (note that GitHub deploy keys must be unique for each repository)\n\n```sh\n$ ssh-keygen -t rsa -b 4096 -C \"your_email@example.com\"\n```\n\n- In GitHub, either:\n\n  - add the unique public keys (`key_name.pub`) to _Repo Settings \u003e Deploy keys_ for each repository respectively and allow write access for the destination repository\n\n  or\n\n  - add the single public key (`key_name.pub`) to _Personal Settings \u003e SSH keys_\n\n- Add the private key(s) to _Repo \u003e Settings \u003e Secrets_ for the repository containing the action (`SSH_PRIVATE_KEY`, or `SOURCE_SSH_PRIVATE_KEY` and `DESTINATION_SSH_PRIVATE_KEY`)\n\n#### Advanced: Sync all branches\n\nTo Sync all branches from source to destination, use `source_branch: \"refs/remotes/source/*\"` and `destination_branch: \"refs/heads/*\"`. But be careful, branches with the same name including `master` will be overwritten.\n\n```yml\nsource_branch: \"refs/remotes/source/*\"\ndestination_branch: \"refs/heads/*\"\n```\n\n#### Advanced: Sync all tags\n\nTo Sync all tags from source to destination, use `source_branch: \"refs/tags/*\"` and `destination_branch: \"refs/tags/*\"`. But be careful, tags with the same name will be overwritten.\n\n```yml\nsource_branch: \"refs/tags/*\"\ndestination_branch: \"refs/tags/*\"\n```\n\n### Docker\n\n```sh\n$ docker run --rm -e \"SSH_PRIVATE_KEY=$(cat ~/.ssh/id_rsa)\" $(docker build -q .) \\\n  $SOURCE_REPO $SOURCE_BRANCH $DESTINATION_REPO $DESTINATION_BRANCH\n```\n\n## Author\n\n[Wei He](https://github.com/wei) _github@weispot.com_\n\n## License\n\n[MIT](https://wei.mit-license.org)\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwei%2Fgit-sync","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwei%2Fgit-sync","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwei%2Fgit-sync/lists"}