{"id":13425963,"url":"https://github.com/jaedle/mirror-to-gitea","last_synced_at":"2025-04-04T11:14:14.224Z","repository":{"id":40749954,"uuid":"174692315","full_name":"jaedle/mirror-to-gitea","owner":"jaedle","description":"Mirror your github repositories to your gitea server","archived":false,"fork":false,"pushed_at":"2024-11-10T12:36:45.000Z","size":245,"stargazers_count":165,"open_issues_count":5,"forks_count":31,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-03-28T10:08:30.247Z","etag":null,"topics":["backup","docker","gitea","github","javascript","mirrored-repositories","mirroring","nodejs","oktokit"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","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/jaedle.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":"2019-03-09T12:34:59.000Z","updated_at":"2025-03-26T16:18:13.000Z","dependencies_parsed_at":"2024-11-09T10:22:00.333Z","dependency_job_id":"e56bb893-454f-46dd-afee-915c984d29b0","html_url":"https://github.com/jaedle/mirror-to-gitea","commit_stats":{"total_commits":68,"total_committers":11,"mean_commits":6.181818181818182,"dds":0.6029411764705883,"last_synced_commit":"4c3ee18afa481515801ad33322af215897e10c0a"},"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jaedle%2Fmirror-to-gitea","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jaedle%2Fmirror-to-gitea/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jaedle%2Fmirror-to-gitea/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jaedle%2Fmirror-to-gitea/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jaedle","download_url":"https://codeload.github.com/jaedle/mirror-to-gitea/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247166168,"owners_count":20894654,"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":["backup","docker","gitea","github","javascript","mirrored-repositories","mirroring","nodejs","oktokit"],"created_at":"2024-07-31T00:01:23.029Z","updated_at":"2025-04-04T11:14:14.205Z","avatar_url":"https://github.com/jaedle.png","language":"JavaScript","funding_links":[],"categories":["JavaScript"],"sub_categories":[],"readme":"# Automatically Mirror Github Repo To Your Gitea Server\n\n## Badges\n\n[![image pulls](https://img.shields.io/docker/pulls/jaedle/mirror-to-gitea.svg)](https://cloud.docker.com/repository/docker/jaedle/mirror-to-gitea)\n\n## Description\n\nThis script automatically mirrors the repositories from a github-user or github-organization to your gitea server.\nOnce started, it will create a mirrored repository under a given token for a gitea user, completely automatically.\n\nExample:\nA github user `github-user` has public repositories `dotfiles` and `zsh-config`.\nStarting the script with a gitea token for the account `gitea-user` will create the following mirrored repositories:\n\n- github.com/github-user/dotfiles \u0026rarr; your-gitea.url/gitea-user/dotfiles\n- github.com/github-user/zsh-config \u0026rarr; your-gitea.url/gitea-user/zsh-config\n\nThe mirror settings are default by your gitea instance.\n\nIt is also possible to mirror private repos, which can be configred here in [#parameters](#parameters). When mirroring\nprivate repos, they will be created as private repos on your gitea server.\n\n## Prerequisites\n\n- A github user or organization with repositories\n- Configured Gitea instance up and running\n- User for Gitea with generated token (Settings -\u003e Applications -\u003e Generate New Token)\n- Docker or Docker Compose\n\n## Running\n\n### Configuration\n\nAll configuration is performed through environment variables. Flags are considered `true` on `true`, `TRUE` or `1`.\n\n| Parameter                   | Required | Type   | Default | Description                                                                                                                                                                                            |\n|-----------------------------|----------|--------|---------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| GITHUB_USERNAME             | yes      | string | -       | The name of the GitHub user or organisation to mirror.                                                                                                                                                 |\n| GITEA_URL                   | yes      | string | -       | The url of your Gitea server.                                                                                                                                                                          |\n| GITEA_TOKEN                 | yes      | string | -       | The token for your gitea user (Settings -\u003e Applications -\u003e Generate New Token). **Attention: if this is set, the token will be transmitted to your specified Gitea instance!**                         |\n| GITHUB_TOKEN                | no*      | string | -       | GitHub token (PAT). Is mandatory in combination with `MIRROR_PRIVATE_REPOSITORIES`.                                                                                                                    |\n| MIRROR_PRIVATE_REPOSITORIES | no       | bool   | FALSE   | If set to `true` your private GitHub Repositories will be mirrored to Gitea. Requires `GITHUB_TOKEN`.                                                                                                  |\n| SKIP_FORKS                  | no       | bool   | FALSE   | If set to `true` will disable the mirroring of forks from your GitHub User / Organisation.                                                                                                             |\n| DELAY                       | no       | int    | 3600    | Number of seconds between program executions. Setting this will only affect how soon after a new repo was created a mirror may appar on Gitea, but has no affect on the ongoing replication. |\n| DRY_RUN                     | no       | bool   | FALSE   | If set to `true` will perform no writing changes to your Gitea instance, but log the planned actions.                                                                                                  |\n| INCLUDE                     | no       | string | \"*\"     | Name based repository filter (include): If any filter matches, the repository will be mirrored. It supports glob format, multiple filters can be separated with commas (`,`)                           |\n| EXCLUDE                     | no       | string | \"\"      | Name based repository filter (exclude). If any filter matches, the repository will not be mirrored. It supports glob format, multiple filters can be separated with commas (`,`). `EXCLUDE` filters are applied after `INCLUDE` ones. \n| SINGLE_RUN                  | no       | bool   | FALSE   | If set to `TRUE` the task is only executed once.                                                                                                                                                       |\n\n### Docker\n\n```sh\ndocker container run \\\n -d \\\n --restart always \\\n -e GITHUB_USERNAME=github-user \\\n -e GITEA_URL=https://your-gitea.url \\\n -e GITEA_TOKEN=please-exchange-with-token \\\n jaedle/mirror-to-gitea:latest\n```\n\nThis will a spin up a docker container which will run forever, mirroring all your repositories once every hour to your\ngitea server.\n\n### Docker Compose\n\n```yaml\nversion: \"3.3\"\nservices:\n  mirror-to-gitea:\n    image: jaedle/mirror-to-gitea:latest\n    restart: unless-stopped\n    container_name: mirror-to-gitea\n    environment:\n      - GITHUB_USERNAME=github-user\n      - GITEA_URL=https://your-gitea.url\n      - GITEA_TOKEN=please-exchange-with-token\n```\n\n## Development\n\n### Prerequisites\n\n- nodejs\n- [task](https://taskfile.dev)\n- docker\n\n### Execute verification\n\n```sh\ntask world\n```\n\n### Running locally\n\nCreate `.secrets.rc` containing at least the following variables:\n\n```rc\nexport GITHUB_USERNAME='...'\nexport GITHUB_TOKEN='...'\nexport GITEA_URL='...'\n```\n\nExecute the script in foreground:\n\n```sh\ntask run-local\n```\n\n## Kudos\n\nKudos to all contributors! 🙏\n\n\u003ca href=\"https://github.com/jaedle/mirror-to-gitea/graphs/contributors\"\u003e\n  \u003cimg src=\"https://contrib.rocks/image?repo=jaedle/mirror-to-gitea\" /\u003e\n\u003c/a\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjaedle%2Fmirror-to-gitea","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjaedle%2Fmirror-to-gitea","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjaedle%2Fmirror-to-gitea/lists"}