{"id":42129244,"url":"https://github.com/katorlys/github-mirror-gitea","last_synced_at":"2026-03-02T06:07:16.128Z","repository":{"id":255192062,"uuid":"847521970","full_name":"katorlys/github-mirror-gitea","owner":"katorlys","description":"Mirror your GitHub repositories to your Gitea server.","archived":false,"fork":false,"pushed_at":"2025-04-11T09:38:40.000Z","size":52,"stargazers_count":3,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-01-27T02:50:05.760Z","etag":null,"topics":["backup","gitea","github-mirror","github-mirror-gitea","mirror","mirror-github","mirror-repositories","python"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mpl-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/katorlys.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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2024-08-26T02:53:31.000Z","updated_at":"2025-04-22T17:32:27.000Z","dependencies_parsed_at":"2024-09-15T14:45:36.217Z","dependency_job_id":null,"html_url":"https://github.com/katorlys/github-mirror-gitea","commit_stats":null,"previous_names":["katorlys/github-mirror-gitea"],"tags_count":2,"template":false,"template_full_name":"katorlys-samples/Template","purl":"pkg:github/katorlys/github-mirror-gitea","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/katorlys%2Fgithub-mirror-gitea","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/katorlys%2Fgithub-mirror-gitea/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/katorlys%2Fgithub-mirror-gitea/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/katorlys%2Fgithub-mirror-gitea/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/katorlys","download_url":"https://codeload.github.com/katorlys/github-mirror-gitea/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/katorlys%2Fgithub-mirror-gitea/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29993606,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-02T01:47:34.672Z","status":"online","status_checked_at":"2026-03-02T02:00:07.342Z","response_time":60,"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":["backup","gitea","github-mirror","github-mirror-gitea","mirror","mirror-github","mirror-repositories","python"],"created_at":"2026-01-26T15:31:51.093Z","updated_at":"2026-03-02T06:07:16.071Z","avatar_url":"https://github.com/katorlys.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003ca name=\"readme-top\"\u003e\u003c/a\u003e\n\u003cdiv align=\"center\"\u003e\n\n\u003c!-- \u003ca href=\"#\"\u003e\n  \u003cimg src=\"https://github.com/katorlys/.github/blob/main/assets/mark/mark.svg\" height=\"100\"\u003e\n\u003c/a\u003e\u003cbr\u003e --\u003e\n\n\u003ch1\u003e\n  github-mirror-gitea\n\u003c/h1\u003e\n\n\u003cp\u003e\n  Mirror your GitHub repositories to your Gitea server.\n\u003c/p\u003e\n\n[![Pull Requests][github-pr-badge]][github-pr-link]\n[![Issues][github-issue-badge]][github-issue-link]\n[![License][github-license-badge]](LICENSE)\n\n\u003c/div\u003e\n\n\n\u003c!-- Main Body --\u003e\n\n## Introduction\nA Python script to mirror all of your GitHub repositories to your Gitea server, with multiple options.\n\nRepositories created are mirrors of the original repositories, and by default Gitea will automatically fetch them every 8 hours.\n\nUsing GitHub APIs and Gitea APIs -- especially the `migrate` function.\n\n### Features\nThere are many options to choose from:\n- Mirror, or not mirror repos:\n  - you own\n  - you forked\n  - you starred\n  - you have access to as a collaborator\n  - you have access to as an organization member\n- Whether to remove existing repos in Gitea\n- Whether to create new organizations in Gitea if `{username}` in `{username}/{repo_name}` doesn't match your GitHub username\n\nWill also mirror your repository description and private status.\n\n### Tech Stack\n- Python3\n\n\n## Getting Started\n### Prerequisites\nAdd the following content in your Gitea server's `gitea/conf/app.ini` file:\n```ini\n[migrations]\nALLOWED_DOMAINS = github.com, *.github.com\n```\n\n### Configuration\nAll credentials are needed to be configured properly:\n\n| Key        | Description                                                                                                                                                                                                                                                                                                                  |\n|:-----------|:-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| **GITHUB** |                                                                                                                                                                                                                                                                                                                              |\n| USERNAME   | Your GitHub username                                                                                                                                                                                                                                                                                                         |\n| PAT        | Your GitHub personal access token, needed permissions:\u003cbr\u003e - repo (Full control of private repositories)\u003cbr\u003e If you only want to mirror public repositories, grant the following only:\u003cbr\u003e - repo:public_repo                                                                                                                |\n| **GITEA**  |                                                                                                                                                                                                                                                                                                                              |\n| USERNAME   | Your Gitea username                                                                                                                                                                                                                                                                                                          |\n| HOST       | Your Gitea hostname, starts with `http://` or `https://`                                                                                                                                                                                                                                                                     |\n| PAT        | Your Gitea personal access token, needed permissions:\u003cbr\u003e - repository: Read and Write\u003cbr\u003e If you set `REMOVE_EXISTING_REPO` in `options.toml` to true, you also need to grant:\u003cbr\u003e - user: Read and Write\u003cbr\u003e If you set `CREATE_ORG` in `options.toml` to true, you also need to grant:\u003cbr\u003e - organization: Read and Write |\n\nYou can customize these options for mirroring:\n\n| Key                  | Description                                                                                                                                                                                                                                              |\n|:---------------------|:---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| **CONFIG**           |                                                                                                                                                                                                                                                          |\n| CREATE_ORG           | Create a new organization in Gitea when the repository username is different from your GitHub username.                                                                                                                                                  |\n| REMOVE_INEXIST_REPO  | Remove all repositories in Gitea owned by the user (including those in organizations) that do not exist in GitHub.                                                                                                                                       |\n| REMOVE_EXISTING_REPO | Remove existing repositories in Gitea. This will only remove the repositories that have the same name as the repositories in GitHub. You may not want to enable this option, since Gitea will automatically fetch the mirror repositories every 8 hours. |\n| MIRROR_OWNED         | Mirror the repositories you own.                                                                                                                                                                                                                         |\n| MIRROR_PRIVATE       | Mirror private repositories you own.                                                                                                                                                                                                                     |\n| MIRROR_FORKED        | Mirror the repositories you forked.                                                                                                                                                                                                                      |\n| MIRROR_STARRED       | Mirror the repositories you starred.                                                                                                                                                                                                                     |\n| MIRROR_COLLABORATOR  | Mirror the repositories that you have collaborator access. See: https://docs.github.com/zh/rest/repos/repos#list-repositories-for-the-authenticated-user                                                                                                 |\n| MIRROR_ORGANIZATION  | Mirror the repositories in organizations that you are a member.                                                                                                                                                                                          |\n| **RULE**             |                                                                                                                                                                                                                                                          |\n| MODE                 | `whitelist` or `blacklist` to only mirror or skip repositories that match the regex.                                                                                                                                                                     |\n| REGEX                | Regex list.                                                                                                                                                                                                                                              |\n\n\n## Usage\n### Python script\nConfigure [`credentials.toml`](config/credentials.toml), and [ `options.toml`](config/options.toml).\n\nClone the repository:\n```bash\ngit clone https://github.com/katorlys/github-mirror-gitea\ncd github-mirror-gitea\n```\nInstall the required packages:\n```bash\npip install -r requirements.txt\n```\nRun the script:\n```bash\npython main.py\n```\n\n### Docker\nMake sure you've modified the `\u003c\u003e` placeholders and the options before running the following command:\n```bash\ndocker run --rm \\\n    -e GITHUB_USERNAME=\u003cGITHUB_USERNAME\u003e \\\n    -e GITHUB_PAT=\u003cGITHUB_PAT\u003e \\\n    -e GITEA_USERNAME=\u003cGITEA_USERNAME\u003e \\\n    -e GITEA_HOST=\u003cGITEA_HOST\u003e \\\n    -e GITEA_PAT=\u003cGITEA_PAT\u003e \\\n    -e CREATE_ORG=true \\\n    -e REMOVE_EXISTING_REPO=false \\\n    -e MIRROR_OWNED=true \\\n    -e MIRROR_PRIVATE=true \\\n    -e MIRROR_FORKED=true \\\n    -e MIRROR_STARRED=false \\\n    -e MIRROR_COLLABORATOR=false \\\n    -e MIRROR_ORGANIZATION=false \\\n    -e RULE_MODE=\"blacklist\" \\\n    -e RULE_REGEX=\"EpicGames/.*,NVIDIAGameWorks/.*\" \\\n    katorlys/github-mirror-gitea:latest\n```\n\n### GitHub Actions\nWe've created a [GitHub Action](https://github.com/katorlys/gitea-mirror-action) for this script. Here's an example workflow file:\n```yml\nname: Mirror GitHub to Gitea\n\non:\n  workflow_dispatch:\n  schedule:\n    - cron: '0 0 * * *'\n\njobs:\n  mirror:\n    runs-on: ubuntu-latest\n\n    steps:\n      - name: GitHub mirror Gitea\n        uses: katorlys/gitea-mirror-action@v1\n        with:\n          GITHUB_USERNAME: ${{ secrets.GH_USERNAME }}\n          GITHUB_PAT: ${{ secrets.GH_PAT }}\n          GITEA_HOST: ${{ secrets.GITEA_HOST }}\n          GITEA_USERNAME: ${{ secrets.GITEA_USERNAME }}\n          GITEA_PAT: ${{ secrets.GITEA_PAT }}\n          CREATE_ORG: true\n          REMOVE_INEXIST_REPO: false\n          REMOVE_EXISTING_REPO: false\n          MIRROR_OWNED: true\n          MIRROR_PRIVATE: true\n          MIRROR_FORKED: true\n          MIRROR_STARRED: false\n          MIRROR_COLLABORATOR: false\n          MIRROR_ORGANIZATION: false\n          MODE: 'blacklist'\n          REGEX: 'EpicGames/.*,NVIDIAGameWorks/.*'\n```\n\nIf you prefer to run our Docker image in GitHub Actions, you can use the following workflow file:\n```yml\nname: Mirror Github to Gitea\n\non:\n  workflow_dispatch:\n\n  schedule:\n    - cron: 0 0 * * *\n\njobs:\n  mirror:\n    runs-on: ubuntu-latest\n\n    steps:\n      - name: Checkout\n        uses: actions/checkout@v4\n\n      - name: Run Docker container\n        run: |\n          docker run --rm \\\n            -e GITHUB_USERNAME=${{ secrets.GH_USERNAME }} \\\n            -e GITHUB_PAT=${{ secrets.GH_PAT }} \\\n            -e GITEA_USERNAME=${{ secrets.GITEA_USERNAME }} \\\n            -e GITEA_HOST=${{ secrets.GITEA_HOST }} \\\n            -e GITEA_PAT=${{ secrets.GITEA_PAT }} \\\n            -e CREATE_ORG=true \\\n            -e REMOVE_EXISTING_REPO=false \\\n            -e MIRROR_OWNED=true \\\n            -e MIRROR_PRIVATE=true \\\n            -e MIRROR_FORKED=true \\\n            -e MIRROR_STARRED=false \\\n            -e MIRROR_COLLABORATOR=false \\\n            -e MIRROR_ORGANIZATION=false \\\n            -e MODE=\"blacklist\" \\\n            -e RULE_REGEX=\"EpicGames/.*,NVIDIAGameWorks/.*\" \\\n            katorlys/github-mirror-gitea:latest\n```\n\n\n## Frequently Asked\n| Error message                                                                                                                                                               | Solution                                                                                |\n|:----------------------------------------------------------------------------------------------------------------------------------------------------------------------------|:----------------------------------------------------------------------------------------|\n| `403 b'{\"message\":\"token does not have at least one of required scope(s):`                                                                                                  | Follow the message's instruction to grant the required permissions to your PAT.         |\n| My repository doesn't exist on Gitea, but the script returns `Skip (exists)`                                                                                                | Please don't transfer the mirrored repository to another user or organization on Gitea. |\n| `b'{\"message\":\"Migration failed: clone error: exit status 128 - fatal: unable to access \\'https://github.com/username/repo.git/\\': Could not resolve host: github.com\\\\n.\"` | Make sure your Gitea host can access GitHub.                                            |\n\n\n\u003c!-- /Main Body --\u003e\n\n\n\u003cdiv align=\"right\"\u003e\n  \n[![BACK TO TOP][back-to-top-button]](#readme-top)\n\n\u003c/div\u003e\n\n---\n\n\u003cdiv align=\"center\"\u003e\n\n\u003cp\u003e\n  Copyright \u0026copy; 2024-present \u003ca target=\"_blank\" href=\"https://github.com/katorlys\"\u003eKatorly Lab\u003c/a\u003e\n\u003c/p\u003e\n\n[![License][github-license-badge-bottom]](LICENSE)\n\n\u003c/div\u003e\n\n[back-to-top-button]: https://img.shields.io/badge/BACK_TO_TOP-151515?style=flat-square\n[github-pr-badge]: https://img.shields.io/github/issues-pr/katorlys/github-mirror-gitea?label=pulls\u0026labelColor=151515\u0026color=79E096\u0026style=flat-square\n[github-pr-link]: https://github.com/katorlys/github-mirror-gitea/pulls\n[github-issue-badge]: https://img.shields.io/github/issues/katorlys/github-mirror-gitea?labelColor=151515\u0026color=FFC868\u0026style=flat-square\n[github-issue-link]: https://github.com/katorlys/github-mirror-gitea/issues\n[github-license-badge]: https://img.shields.io/github/license/katorlys/github-mirror-gitea?labelColor=151515\u0026color=EFEFEF\u0026style=flat-square\n\u003c!-- https://img.shields.io/badge/license-CC_BY--NC--SA_4.0-EFEFEF?labelColor=151515\u0026style=flat-square --\u003e\n[github-license-badge-bottom]: https://img.shields.io/github/license/katorlys/github-mirror-gitea?labelColor=151515\u0026color=EFEFEF\u0026style=for-the-badge\n\u003c!-- https://img.shields.io/badge/license-CC_BY--NC--SA_4.0-EFEFEF?labelColor=151515\u0026style=for-the-badge --\u003e","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkatorlys%2Fgithub-mirror-gitea","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkatorlys%2Fgithub-mirror-gitea","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkatorlys%2Fgithub-mirror-gitea/lists"}