{"id":50705196,"url":"https://github.com/DullJZ/gh-backup","last_synced_at":"2026-06-26T11:00:35.955Z","repository":{"id":316885781,"uuid":"1065213122","full_name":"DullJZ/gh-backup","owner":"DullJZ","description":"使用Actions每天自动备份GitHub仓库到Gitea/Gitlab","archived":false,"fork":false,"pushed_at":"2026-05-07T06:31:07.000Z","size":17,"stargazers_count":5,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-05-07T08:29:39.510Z","etag":null,"topics":["backup","clone","git","gitea","github","gitlab","mirror","mirrored-repository"],"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/DullJZ.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,"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":"2025-09-27T09:20:39.000Z","updated_at":"2026-05-07T06:31:11.000Z","dependencies_parsed_at":"2025-09-27T11:33:41.176Z","dependency_job_id":"6d0088f5-1244-417b-9ce8-1c22bdeeb109","html_url":"https://github.com/DullJZ/gh-backup","commit_stats":null,"previous_names":["dulljz/gh-backup"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/DullJZ/gh-backup","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DullJZ%2Fgh-backup","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DullJZ%2Fgh-backup/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DullJZ%2Fgh-backup/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DullJZ%2Fgh-backup/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/DullJZ","download_url":"https://codeload.github.com/DullJZ/gh-backup/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DullJZ%2Fgh-backup/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34813782,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-26T02:00:06.560Z","response_time":106,"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","clone","git","gitea","github","gitlab","mirror","mirrored-repository"],"created_at":"2026-06-09T11:00:26.343Z","updated_at":"2026-06-26T11:00:35.949Z","avatar_url":"https://github.com/DullJZ.png","language":"Shell","funding_links":[],"categories":["Shell"],"sub_categories":[],"readme":"# GitHub 到 Gitea/GitLab 自动备份\n\n使用 GitHub Actions 每天自动将 GitHub 仓库备份到 Gitea 或 GitLab。\n\n## 功能特点\n\n- 🔧 支持 Gitea 和 GitLab 双平台备份\n- ⏰ 每天凌晨 2 点自动执行\n- 🚀 支持手动触发备份\n- 📦 使用 ghorg 高效克隆所有仓库\n- 🔒 支持公开和私有仓库备份\n\n## 快速开始\n\n### 1. 准备工作\n\n#### Github 备份配置：\n- （可选）自定义 GitHub 访问令牌（需要有repo权限）\n\n如果不设置，脚本将使用 GitHub Actions 默认的 `GITHUB_TOKEN`。但是经过测试，默认令牌获取到的仓库数量有限（40个），建议创建一个新的个人访问令牌。\n\n#### Gitea 备份配置：\n- Gitea 服务器地址\n- Gitea 访问令牌（需要有repo、user权限）\n- 目标组织或用户名\n\n#### GitLab 备份配置：\n- GitLab 服务器地址\n- GitLab 访问令牌（需要有创建项目、读写权限）\n- 目标群组或用户名\n\n### 2. 配置 GitHub Secrets\n\n在 GitHub 仓库设置中，添加以下 Secrets：\n\n#### 基础配置：\n- `BACKUP_GITEA`: `true` 或 `false`\n- `BACKUP_GITLAB`: `true` 或 `false`\n- `VISIBILITY`: `public` 或 `private`\n\n#### Github 配置：\n- `CUSTOM_GITHUB_TOKEN`: GitHub 访问令牌（需要有repo权限）（可选）\n\n#### Gitea 配置：\n- `GITEA_HOST`: Gitea 服务器主机名，如 `git.example.com`\n- `GITEA_TOKEN`: Gitea 访问令牌\n- `GITEA_OWNER`: 目标组织或用户名\n\n#### GitLab 配置：\n- `GITLAB_HOST`: GitLab 服务器主机名，如 `gitlab.com`\n- `GITLAB_TOKEN`: GitLab 访问令牌\n- `GITLAB_OWNER`: 目标群组或用户名\n\n### 3. 手动测试运行\n\n在 GitHub Actions 页面，手动触发工作流以确保配置正确。\n\n## 文件说明\n\n- `backup-to-gitea.sh` - 备份到 Gitea 的脚本\n- `backup-to-gitlab.sh` - 备份到 GitLab 的脚本\n- `.github/workflows/backup.yml` - GitHub Actions 工作流配置\n\n## 自定义配置\n\n### 修改备份时间\n\n编辑 `.github/workflows/backup.yml` 中的 cron 表达式：\n\n```yaml\nschedule:\n  - cron: '0 2 * * *'  # 每天凌晨 2 点\n```\n\n### 备份到 Gitea\n\n设置 GitHub Secrets：`BACKUP_GITEA=true`\n\n### 备份到 GitLab\n\n设置 GitHub Secrets：`BACKUP_GITLAB=true`\n\n## 注意事项\n\n- Gitea/GitLab 用户需要有足够的权限创建仓库\n- 运行可能需要较长时间，取决于仓库数量\n- 建议先在测试环境验证配置正确性\n- 备份过程会强制推送所有分支和标签\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FDullJZ%2Fgh-backup","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FDullJZ%2Fgh-backup","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FDullJZ%2Fgh-backup/lists"}