{"id":49359053,"url":"https://github.com/guilycst/gitmeout","last_synced_at":"2026-04-27T15:02:44.138Z","repository":{"id":344978441,"uuid":"1183780779","full_name":"guilycst/gitmeout","owner":"guilycst","description":"Mirror GitHub repositories to Forgejo/Codeberg instances with push and pull mirror support","archived":false,"fork":false,"pushed_at":"2026-03-17T04:38:13.000Z","size":18,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-03-17T18:37:09.560Z","etag":null,"topics":["backup","cli","codeberg","docker","forgejo","git","github","golang","kubernetes","mirror"],"latest_commit_sha":null,"homepage":null,"language":"Go","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/guilycst.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":"AGENTS.md","dco":null,"cla":null}},"created_at":"2026-03-17T00:14:49.000Z","updated_at":"2026-03-17T04:34:12.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/guilycst/gitmeout","commit_stats":null,"previous_names":["guilycst/gitmeout"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/guilycst/gitmeout","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/guilycst%2Fgitmeout","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/guilycst%2Fgitmeout/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/guilycst%2Fgitmeout/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/guilycst%2Fgitmeout/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/guilycst","download_url":"https://codeload.github.com/guilycst/gitmeout/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/guilycst%2Fgitmeout/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32341455,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-26T23:26:28.701Z","status":"online","status_checked_at":"2026-04-27T02:00:06.769Z","response_time":128,"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","cli","codeberg","docker","forgejo","git","github","golang","kubernetes","mirror"],"created_at":"2026-04-27T15:02:34.385Z","updated_at":"2026-04-27T15:02:44.133Z","avatar_url":"https://github.com/guilycst.png","language":"Go","readme":"# gitmeout\n\n[![CI](https://github.com/guilycst/gitmeout/actions/workflows/ci.yml/badge.svg)](https://github.com/guilycst/gitmeout/actions/workflows/ci.yml)\n[![Release](https://github.com/guilycst/gitmeout/actions/workflows/release.yml/badge.svg)](https://github.com/guilycst/gitmeout/actions/workflows/release.yml)\n[![Go Report Card](https://goreportcard.com/badge/github.com/guilycst/gitmeout)](https://goreportcard.com/report/github.com/guilycst/gitmeout)\n[![GoDoc](https://godoc.org/github.com/guilycst/gitmeout?status.svg)](https://godoc.org/github.com/guilycst/gitmeout)\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\n[![Go Version](https://img.shields.io/badge/Go-1.26-00ADD8?logo=go)](https://go.dev/)\n\n**Container Images:**\n\n[![GHCR](https://img.shields.io/badge/ghcr.io-guilycst/gitmeout-blue)](https://github.com/guilycst/gitmeout/pkgs/container/gitmeout)\n[![Forgejo](https://img.shields.io/badge/code.decastro.me-guilherme/gitmeout-blue)](https://code.decastro.me/guilherme/-/packages/container/gitmeout)\n\n\u003e Mirror GitHub repositories to Forgejo/Codeberg instances\n\nA fast, reliable CLI tool for mirroring repositories from GitHub to Forgejo/Codeberg. Supports both push and pull mirror modes, with flexible filtering and container-ready deployment.\n\n## Features\n\n- **GitHub as source** - Mirror personal and organization repositories\n- **Forgejo/Codeberg as targets** - Create mirror repos on any Forgejo instance\n- **Flexible filtering** - Filter by personal repos, orgs, or explicit repo list\n- **Wildcard support** - Use `owner/*` to mirror all repos from an owner\n- **Dual mirror types** - Push mirrors (clone + push) or pull mirrors (Forgejo MigrateRepo API)\n- **Token-only auth** - Secure authentication via Personal Access Tokens\n- **Container-ready** - Docker image and Kubernetes manifests included\n- **Multiarch support** - Linux amd64/arm64 binaries and Docker images\n\n## ⚠️ Disclaimer\n\n**Use this tool responsibly and only for repositories you own or have permission to mirror.**\n\n- **Personal Use**: This tool is designed for mirroring your own repositories or repositories you have explicit permission to mirror.\n- **GitHub ToS**: Ensure your usage complies with [GitHub's Terms of Service](https://docs.github.com/en/site-policy/github-terms/github-terms-of-service), including API rate limits and acceptable use policies.\n- **Rate Limits**: GitHub's API has rate limits (5,000 authenticated requests/hour). Be mindful when mirroring large numbers of repositories.\n- **Data Portability**: GitHub's ToS supports user data portability for your own content.\n- **No Warranty**: This software is provided \"as is\" without warranty of any kind. The authors are not responsible for any issues arising from its use.\n\nBy using this tool, you agree to:\n- Only mirror repositories you own or have permission to mirror\n- Comply with GitHub's API Terms of Service\n- Respect rate limits and not abuse the API\n- Use it for legitimate data portability purposes\n\n## Quick Start\n\n### 1. Create a config file\n\n```yaml\nsource:\n  type: github\n  token: ${GITHUB_TOKEN}\n  filters:\n    personal: true\n    orgs:\n      - my-org\n    repos:\n      - owner/repo1\n      - owner/*\n\ntargets:\n  - name: codeberg\n    type: forgejo\n    url: https://codeberg.org\n    token: ${CODEBERG_TOKEN}\n```\n\n### 2. Set environment variables\n\n```bash\nexport GITHUB_TOKEN=\"ghp_xxx\"\nexport CODEBERG_TOKEN=\"xxx\"\n```\n\n### 3. Run\n\n```bash\n# Using Just\njust run\n\n# Or directly\ngo run ./cmd/gitmeout\n\n# Or with Docker\ndocker run --rm \\\n  -e GITHUB_TOKEN \\\n  -e CODEBERG_TOKEN \\\n  -v $(pwd)/config.yaml:/app/config.yaml:ro \\\n  ghcr.io/guilycst/gitmeout:latest\n```\n\n## Configuration\n\n### Source Configuration\n\n| Field | Type | Required | Description |\n|-------|------|----------|-------------|\n| `type` | string | Yes | Provider type. Currently only `github` |\n| `token` | string | Yes | GitHub Personal Access Token. Use `${VAR}` for env vars |\n| `filters.personal` | bool | No | Mirror personal repos. Default: `true` |\n| `filters.orgs` | []string | No | List of organization names to mirror |\n| `filters.repos` | []string | No | Explicit repo list. Use `owner/*` for all repos from an owner |\n\n### Target Configuration\n\n| Field | Type | Required | Description |\n|-------|------|----------|-------------|\n| `name` | string | Yes | Friendly name for logging |\n| `type` | string | Yes | Provider type. Currently only `forgejo` |\n| `url` | string | Yes | Base URL of the Forgejo instance |\n| `token` | string | Yes | Forgejo Personal Access Token. Use `${VAR}` for env vars |\n| `mirror_type` | string | No | `push` (default) or `pull` - see Mirror Types below |\n\n### Mirror Types\n\n**Push Mirrors** (`mirror_type: push`):\n- Clones the repository from GitHub, then pushes `--mirror` to the target\n- Syncs every run - changes on source are pushed to target\n- Use for: Codeberg (pull mirrors disabled by admin)\n\n**Pull Mirrors** (`mirror_type: pull`):\n- Uses Forgejo's MigrateRepo API to create a pull mirror\n- Forgejo periodically fetches changes from the source automatically\n- Use for: Self-hosted Forgejo instances where pull mirrors are enabled\n- Skips if a mirror already exists\n\n### Environment Variable Interpolation\n\nUse `${VAR_NAME}` syntax in config values to reference environment variables:\n\n```yaml\nsource:\n  token: ${GITHUB_TOKEN}  # Reads from $GITHUB_TOKEN env var\n```\n\n## Behavior\n\n### Repository Resolution\n\n1. **Personal repos**: If `personal: true`, fetches all repos owned by the authenticated user\n2. **Organization repos**: For each org in `orgs`, fetches all repos the user can access\n3. **Explicit repos**: Resolves each entry in `repos`:\n   - `owner/repo-name`: Specific repo\n   - `owner/*`: All repos from that owner\n\n### Mirror Creation\n\n- **Existing mirrors**: If a mirror repo already exists on the target, it is skipped\n- **New mirrors**: Creates a new mirror repo pointing to the source\n\n### Required Token Permissions\n\n**GitHub**:\n- `repo` (for private repos)\n- `read:org` (if filtering by orgs)\n\n**Forgejo/Codeberg**:\n- `read:user` - required to get authenticated user info\n- `write:repository` - required to create mirror repositories\n\n## Deployment\n\n### Docker\n\n```bash\ndocker build -t gitmeout:latest .\ndocker run --rm \\\n  -e GITHUB_TOKEN \\\n  -e CODEBERG_TOKEN \\\n  -v $(pwd)/config.yaml:/app/config.yaml:ro \\\n  gitmeout:latest\n```\n\n### Kubernetes\n\nCreate a secret for your config:\n\n```bash\nkubectl create secret generic gitmeout-config --from-file=config.yaml=config.yaml\n```\n\nApply the CronJob:\n\n```bash\nkubectl apply -f deploy/k8s/cronjob.yaml\n```\n\nSee `deploy/k8s/` for Job and CronJob examples.\n\n### Kubernetes Custom Resource\n\nFor GitOps workflows, see `deploy/k8s/job.yaml` for a Job CR that can be used with tools like ArgoCD or Flux.\n\n## Development\n\n```bash\n# Install dependencies\ngo mod download\n\n# Build\njust build\n\n# Run tests\njust test\n\n# Lint\njust lint\n\n# Format\njust fmt\n\n# Run all checks\njust validate\n```\n\n## License\n\nMIT License - see [LICENSE](LICENSE) for details.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fguilycst%2Fgitmeout","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fguilycst%2Fgitmeout","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fguilycst%2Fgitmeout/lists"}