{"id":20612041,"url":"https://github.com/tcarrio/github-mirror","last_synced_at":"2026-05-18T03:34:48.971Z","repository":{"id":93830370,"uuid":"304974410","full_name":"tcarrio/github-mirror","owner":"tcarrio","description":"[Mirror] Demo project showcasing mirror functionality using default Git and SSH tooling","archived":false,"fork":false,"pushed_at":"2020-10-17T22:25:45.000Z","size":6,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-08-21T18:40:40.492Z","etag":null,"topics":["ci","git"],"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/tcarrio.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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":"2020-10-17T21:44:13.000Z","updated_at":"2020-10-18T00:30:38.000Z","dependencies_parsed_at":"2023-06-15T06:45:09.695Z","dependency_job_id":null,"html_url":"https://github.com/tcarrio/github-mirror","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/tcarrio/github-mirror","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tcarrio%2Fgithub-mirror","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tcarrio%2Fgithub-mirror/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tcarrio%2Fgithub-mirror/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tcarrio%2Fgithub-mirror/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tcarrio","download_url":"https://codeload.github.com/tcarrio/github-mirror/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tcarrio%2Fgithub-mirror/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33163769,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-17T22:39:12.733Z","status":"online","status_checked_at":"2026-05-18T02:00:06.436Z","response_time":71,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["ci","git"],"created_at":"2024-11-16T10:23:02.500Z","updated_at":"2026-05-18T03:34:48.949Z","avatar_url":"https://github.com/tcarrio.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# GitHub Mirror\n\nThis is an example repository of how you can integrate git mirroring into the SourceHut build pipelines. Git is essentially built with this functionality, you simply need write access to the target repository. Here we will use an SSH token to push the latest master branch to a GitHub repository.\n\nThis solution is meant to tie in easily with the build tools provided by SourceHut, but another means of doing this could be an OAuth app you have given write access to your repositories. The build tooling itself may be useful for propogating the initial event to a third-party server with the access to push code to your repository. That flow is not covered here, but if I care to do an example app for that functionality in the future, I'll make a point to update this repo with a reference to it.\n\n**Note:** this will work for any Git project, it isn't specific to GitHub, I'm just doing a demo of it using GitHub as the target.\n\n## Getting Started\n\n1. Generate an SSH token and add it to your GitHub account\n2. Generate a file secret on https://builds.sr.ht/secrets to load at `~/.ssh/id_rsa`\n3. Update your `.builds.yml` pipeline with the following:\n  - Include the secret reference under the `secrets`\n  - Include this repository under the `sources`\n  - Include the `build` stage of the example pipeline in your pipeline\n  - Include the target repository as the environment variable `$GIT_TARGET_URL`\n\n## What's happening\n\nRepositories listed under `sources` are cloned to the current working directory, so you will have directories per repo that you can reference using `./repo-name`. This repository includes a simple shell script that will use your SSH token at `~/.ssh/id_rsa` to push your current branch to the target git repository's branch. Simple stuff.\n\n**Warning:** This forces the push, taking into consideration that the target should be a downstream mirror, it will overwrite the state there should it have a diverged git history from your SourceHut repo.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftcarrio%2Fgithub-mirror","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftcarrio%2Fgithub-mirror","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftcarrio%2Fgithub-mirror/lists"}